summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2006-06-14 11:45:01 +0000
committermaxim <maxim@FreeBSD.org>2006-06-14 11:45:01 +0000
commitdd28c26ad5dacbf923394872ab6b28b291c20b93 (patch)
treee04ff2b635f72f6e81d59f09f2ab44c05d6f7e1b
parent1092903e053d6bca1cb8448e6f1e34839c574128 (diff)
downloadFreeBSD-src-dd28c26ad5dacbf923394872ab6b28b291c20b93.zip
FreeBSD-src-dd28c26ad5dacbf923394872ab6b28b291c20b93.tar.gz
o Replace (an incorrect) string copy gymnastics with strlcpy(3).
PR: bin/98905 Submitted by: Fabian Keil MFC after: 1 week
-rw-r--r--sbin/devfs/devfs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sbin/devfs/devfs.c b/sbin/devfs/devfs.c
index f531f75..b232f2a 100644
--- a/sbin/devfs/devfs.c
+++ b/sbin/devfs/devfs.c
@@ -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);
OpenPOWER on IntegriCloud