The buffer returned by fgenln is not a "C" string and might not be NUL
terminated. Make sure that it is before using it. Reviewed by: marck@ MFC after: 3 days
This commit is contained in:
parent
d830c305ea
commit
68961d1200
@ -34,6 +34,7 @@
|
||||
#define Strcpy (void)strcpy
|
||||
#define Strcat (void)strcat
|
||||
#define Strlcpy (void)strlcpy
|
||||
#define Strncpy (void)strncpy
|
||||
#define Strlcat (void)strlcat
|
||||
|
||||
/* NeXT declares malloc and realloc incompatibly from us in some of
|
||||
|
@ -1176,7 +1176,8 @@ pgets(bool do_indent)
|
||||
indent++;
|
||||
}
|
||||
}
|
||||
Strlcpy(buf, line, len + 1 - skipped);
|
||||
Strncpy(buf, line, len - skipped);
|
||||
buf[len - skipped] = '\0';
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user