From af153cbd78db98f22949db4c58c342ed0a569ff3 Mon Sep 17 00:00:00 2001 From: mrg Date: Tue, 13 Apr 2021 01:38:04 +0000 Subject: [PATCH] properly terminate a string after strncpy(). --- usr.bin/checknr/checknr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/checknr/checknr.c b/usr.bin/checknr/checknr.c index f272eadcfbce..902c5abc14df 100644 --- a/usr.bin/checknr/checknr.c +++ b/usr.bin/checknr/checknr.c @@ -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, 1993\ #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");