Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/altq/altqstat usr.sbin/altq: Fix -Wstringop-truncat...
details: https://anonhg.NetBSD.org/src/rev/7cd4905a710d
branches: trunk
changeset: 1007130:7cd4905a710d
user: fox <fox%NetBSD.org@localhost>
date: Fri Feb 07 20:13:26 2020 +0000
description:
usr.sbin/altq: Fix -Wstringop-truncation warning.
Looks like the original intention was to truncate the string at len.
Replace strncpy(3) with strlcpy(3).
Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.
Reviewed by: kamil@
diffstat:
usr.sbin/altq/altqstat/quip_client.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diffs (19 lines):
diff -r fba47964a555 -r 7cd4905a710d usr.sbin/altq/altqstat/quip_client.c
--- a/usr.sbin/altq/altqstat/quip_client.c Fri Feb 07 19:56:51 2020 +0000
+++ b/usr.sbin/altq/altqstat/quip_client.c Fri Feb 07 20:13:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: quip_client.c,v 1.12 2016/02/17 19:51:29 christos Exp $ */
+/* $NetBSD: quip_client.c,v 1.13 2020/02/07 20:13:26 fox Exp $ */
/* $KAME: quip_client.c,v 1.9 2003/05/17 05:59:00 itojun Exp $ */
/*
* Copyright (C) 1999-2000
@@ -454,8 +454,7 @@
else
len = strlen(name);
len = MIN(len, 63);
- strncpy(ifname, name, len);
- ifname[len] = '\0';
+ strlcpy(ifname, name, len);
return (ifname);
}
Home |
Main Index |
Thread Index |
Old Index