Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/lib/libc/gen Pull up revision 1.24 (requested by groo):



details:   https://anonhg.NetBSD.org/src/rev/4c5768bd9d91
branches:  netbsd-1-5
changeset: 493059:4c5768bd9d91
user:      he <he%NetBSD.org@localhost>
date:      Wed Apr 17 11:30:12 2002 +0000

description:
Pull up revision 1.24 (requested by groo):
  Replace an instance of erroneous usage of strncpy() with strlcpy().

diffstat:

 lib/libc/gen/fstab.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 7c7be2eb41a3 -r 4c5768bd9d91 lib/libc/gen/fstab.c
--- a/lib/libc/gen/fstab.c      Wed Apr 17 11:22:49 2002 +0000
+++ b/lib/libc/gen/fstab.c      Wed Apr 17 11:30:12 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fstab.c,v 1.22.4.1 2001/10/27 19:19:14 he Exp $        */
+/*     $NetBSD: fstab.c,v 1.22.4.2 2002/04/17 11:30:12 he Exp $        */
 
 /*
  * Copyright (c) 1980, 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)fstab.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fstab.c,v 1.22.4.1 2001/10/27 19:19:14 he Exp $");
+__RCSID("$NetBSD: fstab.c,v 1.22.4.2 2002/04/17 11:30:12 he Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -146,7 +146,11 @@
                        if ((cp = nextfld(&lp, ws)) != NULL)
                                _fs_fstab.fs_passno = atoi(cp);
                }
-               sp = strncpy(subline, _fs_fstab.fs_mntops, sizeof(subline)-1);
+
+               /* subline truncated iff line truncated */
+               (void)strlcpy(subline, _fs_fstab.fs_mntops, sizeof(subline));
+               sp = subline;
+
                while ((cp = nextfld(&sp, ",")) != NULL) {
                        char **tp;
 



Home | Main Index | Thread Index | Old Index