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/2e1623938212
branches:  trunk
changeset: 455059:2e1623938212
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 d8a02b131fed -r 2e1623938212 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