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:
Maxim Konovalov 2006-06-14 11:45:01 +00:00
parent c0e9fdd321
commit fee8a46e77
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159604

View File

@ -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);