Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/bootp/common Fix under-allocation-by-one



details:   https://anonhg.NetBSD.org/src/rev/3884c68ed2fb
branches:  trunk
changeset: 770178:3884c68ed2fb
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Oct 07 10:06:39 2011 +0000

description:
Fix under-allocation-by-one

diffstat:

 usr.sbin/bootp/common/readfile.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (24 lines):

diff -r e5425e9157aa -r 3884c68ed2fb usr.sbin/bootp/common/readfile.c
--- a/usr.sbin/bootp/common/readfile.c  Fri Oct 07 09:56:15 2011 +0000
+++ b/usr.sbin/bootp/common/readfile.c  Fri Oct 07 10:06:39 2011 +0000
@@ -22,7 +22,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: readfile.c,v 1.18 2011/01/04 09:16:17 wiz Exp $");
+__RCSID("$NetBSD: readfile.c,v 1.19 2011/10/07 10:06:39 joerg Exp $");
 #endif
 
 
@@ -1208,9 +1208,9 @@
        (void) get_string(src, retstring, &length);
 
        s = (struct shared_string *) smalloc(sizeof(struct shared_string) +
-           length);
+           length + 1);
        s->linkcount = 1;
-       strlcpy(s->string, retstring, sizeof(retstring));
+       memcpy(s->string, retstring, length + 1);
 
        return s;
 }



Home | Main Index | Thread Index | Old Index