From 630723670f6dbd04f83c13ea1da9c8e7ef00b09d Mon Sep 17 00:00:00 2001 From: mrg Date: Sat, 5 Oct 2019 23:30:22 +0000 Subject: [PATCH] memcpy->strncpy, and avoid copying beyond the static string length into potentially unmapped regions. --- usr.sbin/eeprom/eehandlers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/eeprom/eehandlers.c b/usr.sbin/eeprom/eehandlers.c index 1fc56f90e690..94a0b2a25008 100644 --- a/usr.sbin/eeprom/eehandlers.c +++ b/usr.sbin/eeprom/eehandlers.c @@ -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 @@ doio(const struct keytabent *ktent, u_char *buf, ssize_t len, int wr) 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); }