From fee8a46e777e8ae249540183819a17ab1fea6a74 Mon Sep 17 00:00:00 2001 From: Maxim Konovalov Date: Wed, 14 Jun 2006 11:45:01 +0000 Subject: [PATCH] o Replace (an incorrect) string copy gymnastics with strlcpy(3). PR: bin/98905 Submitted by: Fabian Keil MFC after: 1 week --- sbin/devfs/devfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/devfs/devfs.c b/sbin/devfs/devfs.c index f531f7521cb1..b232f2a561bc 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);