Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/checknr properly terminate a string after strncpy().
details: https://anonhg.NetBSD.org/src/rev/d0720e024243
branches: trunk
changeset: 982425:d0720e024243
user: mrg <mrg%NetBSD.org@localhost>
date: Tue Apr 13 01:38:04 2021 +0000
description:
properly terminate a string after strncpy().
diffstat:
usr.bin/checknr/checknr.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r 2540a941d2ad -r d0720e024243 usr.bin/checknr/checknr.c
--- a/usr.bin/checknr/checknr.c Tue Apr 13 01:15:57 2021 +0000
+++ b/usr.bin/checknr/checknr.c Tue Apr 13 01:38:04 2021 +0000
@@ -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 @@
#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 @@
* 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");
Home |
Main Index |
Thread Index |
Old Index