mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 08:09:08 +00:00
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);
|
||||
if (*line == NULL)
|
||||
errx(1, "cannot allocate memory");
|
||||
memcpy(*line, cp, rv);
|
||||
*line[rv] = '\0';
|
||||
rv = strlcpy(*line, cp, rv + 1);
|
||||
}
|
||||
assert(rv == strlen(*line));
|
||||
return (rv);
|
||||
|
Loading…
Reference in New Issue
Block a user