Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/stand/common Avoid buffer overruns (no practi...



details:   https://anonhg.NetBSD.org/src/rev/787d065588a5
branches:  trunk
changeset: 325583:787d065588a5
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Dec 30 08:43:28 2013 +0000

description:
Avoid buffer overruns (no practical difference for any sane firmware
properties, but better be safe).

diffstat:

 sys/arch/sparc/stand/common/promdev.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r 8f21fc44cdd8 -r 787d065588a5 sys/arch/sparc/stand/common/promdev.c
--- a/sys/arch/sparc/stand/common/promdev.c     Mon Dec 30 08:43:22 2013 +0000
+++ b/sys/arch/sparc/stand/common/promdev.c     Mon Dec 30 08:43:28 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: promdev.c,v 1.26 2010/09/02 03:14:42 uwe Exp $ */
+/*     $NetBSD: promdev.c,v 1.27 2013/12/30 08:43:28 martin Exp $ */
 
 /*
  * Copyright (c) 1993 Paul Kranenburg
@@ -583,6 +583,8 @@
 static char buf[64];
 
        len = prom_proplen(node, name);
+       if (len > sizeof(buf))
+               len = sizeof(buf)-1;
        if (len > 0)
                _prom_getprop(node, name, buf, len);
        else



Home | Main Index | Thread Index | Old Index