Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/fstyp fstyp: Use strlcpy(3) for HAMMER1



details:   https://anonhg.NetBSD.org/src/rev/dc31f2ed2aef
branches:  trunk
changeset: 968409:dc31f2ed2aef
user:      tkusumi <tkusumi%NetBSD.org@localhost>
date:      Wed Jan 15 15:30:46 2020 +0000

description:
fstyp: Use strlcpy(3) for HAMMER1

https://reviews.freebsd.org/D23159
taken-from: DragonFlyBSD originally from FreeBSD

diffstat:

 usr.sbin/fstyp/hammer.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 39b46fd29869 -r dc31f2ed2aef usr.sbin/fstyp/hammer.c
--- a/usr.sbin/fstyp/hammer.c   Wed Jan 15 13:22:03 2020 +0000
+++ b/usr.sbin/fstyp/hammer.c   Wed Jan 15 15:30:46 2020 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: hammer.c,v 1.2 2020/01/03 08:19:14 tkusumi Exp $      */
+/*        $NetBSD: hammer.c,v 1.3 2020/01/15 15:30:46 tkusumi Exp $      */
 
 /*-
  * Copyright (c) 2016-2019 The DragonFly Project
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hammer.c,v 1.2 2020/01/03 08:19:14 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hammer.c,v 1.3 2020/01/15 15:30:46 tkusumi Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -72,7 +72,7 @@
                assert(count != 0);
                memcpy(&fsid, &ondisk->vol_fsid, sizeof(fsid));
                memcpy(&fstype, &ondisk->vol_fstype, sizeof(fstype));
-               strncpy(label, ondisk->vol_label, sizeof(label));
+               strlcpy(label, ondisk->vol_label, sizeof(label));
        } else {
                if (ondisk->vol_count != count)
                        return (5);
@@ -80,7 +80,7 @@
                        return (6);
                if (memcmp(&ondisk->vol_fstype, &fstype, sizeof(fstype)))
                        return (7);
-               if (strncmp(ondisk->vol_label, label, sizeof(label)))
+               if (strcmp(ondisk->vol_label, label))
                        return (8);
        }
 



Home | Main Index | Thread Index | Old Index