M_ZERO the temp buffer in expand_name() otherwise if an error occurs

while logging we may pass a non NUL terminated string to log(9) for a
%s format arg.
This commit is contained in:
Alfred Perlstein
2002-05-07 23:37:07 +00:00
parent 90f7fe63e9
commit b2bc3101a8
+1 -1
View File
@@ -1886,7 +1886,7 @@ const char *name; uid_t uid; pid_t pid; {
char *format = corefilename;
size_t namelen;
temp = malloc(MAXPATHLEN + 1, M_TEMP, M_NOWAIT);
temp = malloc(MAXPATHLEN + 1, M_TEMP, M_NOWAIT | M_ZERO);
if (temp == NULL)
return NULL;
namelen = strlen(name);