o Revert a previous delta as strlcpy(3) operates with NUL-terminated
strings and cp is not. Fix logic in the original code and eliminate core dumps on lines without '\n'.
This commit is contained in:
parent
dd28c26ad5
commit
99fa74bcc2
@ -162,7 +162,8 @@ efgetln(FILE *fp, char **line)
|
||||
*line = malloc(rv + 1);
|
||||
if (*line == NULL)
|
||||
errx(1, "cannot allocate memory");
|
||||
rv = strlcpy(*line, cp, rv + 1);
|
||||
memcpy(*line, cp, rv);
|
||||
(*line)[rv] = '\0';
|
||||
}
|
||||
assert(rv == strlen(*line));
|
||||
return (rv);
|
||||
|
Loading…
Reference in New Issue
Block a user