Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): replace strcpy with memcpy in Hash_Cre...



details:   https://anonhg.NetBSD.org/src/rev/518cb2df1ec1
branches:  trunk
changeset: 955565:518cb2df1ec1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 03 23:16:28 2020 +0000

description:
make(1): replace strcpy with memcpy in Hash_CreateEntry

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

diffstat:

 usr.bin/make/hash.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 07ab7839756d -r 518cb2df1ec1 usr.bin/make/hash.c
--- a/usr.bin/make/hash.c       Sat Oct 03 22:33:26 2020 +0000
+++ b/usr.bin/make/hash.c       Sat Oct 03 23:16:28 2020 +0000
@@ -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 @@
        *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)



Home | Main Index | Thread Index | Old Index