o Replace (an incorrect) string copy gymnastics with strlcpy(3).
PR: bin/98905 Submitted by: Fabian Keil MFC after: 1 week
This commit is contained in:
parent
c0e9fdd321
commit
fee8a46e77
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159604
@ -162,8 +162,7 @@ efgetln(FILE *fp, char **line)
|
|||||||
*line = malloc(rv + 1);
|
*line = malloc(rv + 1);
|
||||||
if (*line == NULL)
|
if (*line == NULL)
|
||||||
errx(1, "cannot allocate memory");
|
errx(1, "cannot allocate memory");
|
||||||
memcpy(*line, cp, rv);
|
rv = strlcpy(*line, cp, rv + 1);
|
||||||
*line[rv] = '\0';
|
|
||||||
}
|
}
|
||||||
assert(rv == strlen(*line));
|
assert(rv == strlen(*line));
|
||||||
return (rv);
|
return (rv);
|
||||||
|
Loading…
Reference in New Issue
Block a user