Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/eeprom memcpy->strncpy, and avoid copying beyond th...



details:   https://anonhg.NetBSD.org/src/rev/b5e29c39d7e4
branches:  trunk
changeset: 1003952:b5e29c39d7e4
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Oct 05 23:30:22 2019 +0000

description:
memcpy->strncpy, and avoid copying beyond the static string length
into potentially unmapped regions.

diffstat:

 usr.sbin/eeprom/eehandlers.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r c36f59912ddc -r b5e29c39d7e4 usr.sbin/eeprom/eehandlers.c
--- a/usr.sbin/eeprom/eehandlers.c      Sat Oct 05 23:27:20 2019 +0000
+++ b/usr.sbin/eeprom/eehandlers.c      Sat Oct 05 23:30:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eehandlers.c,v 1.18 2013/07/02 11:59:46 joerg Exp $    */
+/*     $NetBSD: eehandlers.c,v 1.19 2019/10/05 23:30:22 mrg Exp $      */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -530,7 +530,7 @@
 
        buf2 = (u_char *)calloc(1, len);
        if (buf2 == NULL) {
-               memcpy(err_str, "memory allocation failed", sizeof err_str);
+               strncpy(err_str, "memory allocation failed", sizeof err_str);
                return (1);
        }
 



Home | Main Index | Thread Index | Old Index