Module Name: src
Committed By: mrg
Date: Tue Apr 13 01:38:04 UTC 2021
Modified Files:
src/usr.bin/checknr: checknr.c
Log Message:
properly terminate a string after strncpy().
To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/checknr/checknr.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.bin/checknr/checknr.c
diff -u src/usr.bin/checknr/checknr.c:1.24 src/usr.bin/checknr/checknr.c:1.25
--- src/usr.bin/checknr/checknr.c:1.24 Mon Aug 12 14:03:18 2013
+++ src/usr.bin/checknr/checknr.c Tue Apr 13 01:38:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: checknr.c,v 1.24 2013/08/12 14:03:18 joerg Exp $ */
+/* $NetBSD: checknr.c,v 1.25 2021/04/13 01:38:04 mrg Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
#if 0
static char sccsid[] = "@(#)checknr.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: checknr.c,v 1.24 2013/08/12 14:03:18 joerg Exp $");
+__RCSID("$NetBSD: checknr.c,v 1.25 2021/04/13 01:38:04 mrg Exp $");
#endif
#endif /* not lint */
@@ -325,6 +325,7 @@ process(FILE *f)
* find and isolate the macro/command name.
*/
strncpy(mac, line+1, 4);
+ mac[4] = '\0';
if (isspace((unsigned char)mac[0])) {
pe(lineno);
printf("Empty command\n");