Module Name:    src
Committed By:   rillig
Date:           Sat Oct  3 23:16:29 UTC 2020

Modified Files:
        src/usr.bin/make: hash.c

Log Message:
make(1): replace strcpy with memcpy in Hash_CreateEntry

The string length is already known, no need to recalculate it.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/hash.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/make/hash.c
diff -u src/usr.bin/make/hash.c:1.37 src/usr.bin/make/hash.c:1.38
--- src/usr.bin/make/hash.c:1.37	Sat Oct  3 22:33:26 2020
+++ src/usr.bin/make/hash.c	Sat Oct  3 23:16:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.37 2020/10/03 22:33:26 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.38 2020/10/03 23:16:28 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -79,7 +79,7 @@
 #include "make.h"
 
 /*	"@(#)hash.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: hash.c,v 1.37 2020/10/03 22:33:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: hash.c,v 1.38 2020/10/03 23:16:28 rillig Exp $");
 
 /*
  * Forward references to local procedures that are used before they're
@@ -243,7 +243,7 @@ Hash_CreateEntry(Hash_Table *t, const ch
 	*hp = e;
 	Hash_SetValue(e, NULL);
 	e->namehash = h;
-	(void)strcpy(e->name, key);
+	memcpy(e->name, key, keylen + 1);
 	t->numEntries++;
 
 	if (newPtr != NULL)

Reply via email to