Module Name:    src
Committed By:   fox
Date:           Fri Feb  7 20:13:26 UTC 2020

Modified Files:
        src/usr.sbin/altq/altqstat: quip_client.c

Log Message:
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@


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/altq/altqstat/quip_client.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqstat/quip_client.c
diff -u src/usr.sbin/altq/altqstat/quip_client.c:1.12 src/usr.sbin/altq/altqstat/quip_client.c:1.13
--- src/usr.sbin/altq/altqstat/quip_client.c:1.12	Wed Feb 17 19:51:29 2016
+++ src/usr.sbin/altq/altqstat/quip_client.c	Fri Feb  7 20:13:26 2020
@@ -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 @@ extract_ifname(const char *name)
 	else
 		len = strlen(name);
 	len = MIN(len, 63);
-	strncpy(ifname, name, len);
-	ifname[len] = '\0';
+	strlcpy(ifname, name, len);
 	return (ifname);
 }
 

Reply via email to