Module Name:    src
Committed By:   christos
Date:           Sun Oct 13 19:39:15 UTC 2019

Modified Files:
        src/usr.bin/locate/code: locate.code.c

Log Message:
fool gcc with strncpy.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/locate/code/locate.code.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/locate/code/locate.code.c
diff -u src/usr.bin/locate/code/locate.code.c:1.11 src/usr.bin/locate/code/locate.code.c:1.12
--- src/usr.bin/locate/code/locate.code.c:1.11	Sun Sep  4 16:28:40 2011
+++ src/usr.bin/locate/code/locate.code.c	Sun Oct 13 15:39:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locate.code.c,v 1.11 2011/09/04 20:28:40 joerg Exp $	*/
+/*	$NetBSD: locate.code.c,v 1.12 2019/10/13 19:39:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)locate.code.c	8.4 (Berkeley) 5/4/95";
 #endif
-__RCSID("$NetBSD: locate.code.c,v 1.11 2011/09/04 20:28:40 joerg Exp $");
+__RCSID("$NetBSD: locate.code.c,v 1.12 2019/10/13 19:39:15 christos Exp $");
 #endif /* not lint */
 
 /*
@@ -119,7 +119,8 @@ main(int argc, char *argv[])
 		usage();
 
 	/* First copy bigram array to stdout. */
-	strncpy(bigrams, argv[0], BGBUFSIZE + 1);
+	strncpy(bigrams, argv[0], BGBUFSIZE);
+	bigrams[BGBUFSIZE] = '\0';
 	if (fwrite(bigrams, 1, BGBUFSIZE, stdout) != BGBUFSIZE)
 		err(1, "stdout");
 

Reply via email to