summaryrefslogtreecommitdiffstats
path: root/sbin/devfs
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2006-06-14 15:09:52 +0000
committermaxim <maxim@FreeBSD.org>2006-06-14 15:09:52 +0000
commit99fa74bcc24b8d061baa61cf998edf7553bac15c (patch)
treed7b1a07fee94894709e1b5b264f9089fdebf4d11 /sbin/devfs
parentdd28c26ad5dacbf923394872ab6b28b291c20b93 (diff)
downloadFreeBSD-src-99fa74bcc24b8d061baa61cf998edf7553bac15c.zip
FreeBSD-src-99fa74bcc24b8d061baa61cf998edf7553bac15c.tar.gz
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'.
Diffstat (limited to 'sbin/devfs')
-rw-r--r--sbin/devfs/devfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/devfs/devfs.c b/sbin/devfs/devfs.c
index b232f2a..0e7b662 100644
--- a/sbin/devfs/devfs.c
+++ b/sbin/devfs/devfs.c
@@ -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);
OpenPOWER on IntegriCloud