Source-Changes-HG archive

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

[src/netbsd-1-5]: src/lib/libc/gen Pull up revision 1.35 (requested by groo):



details:   https://anonhg.NetBSD.org/src/rev/a898ebade65e
branches:  netbsd-1-5
changeset: 493060:a898ebade65e
user:      he <he%NetBSD.org@localhost>
date:      Wed Apr 17 11:32:47 2002 +0000

description:
Pull up revision 1.35 (requested by groo):
  Detect if line length exceeds buffer size.

diffstat:

 lib/libc/gen/getcap.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 4c5768bd9d91 -r a898ebade65e lib/libc/gen/getcap.c
--- a/lib/libc/gen/getcap.c     Wed Apr 17 11:30:12 2002 +0000
+++ b/lib/libc/gen/getcap.c     Wed Apr 17 11:32:47 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getcap.c,v 1.33.2.1 2001/10/26 18:06:41 jhawk Exp $    */
+/*     $NetBSD: getcap.c,v 1.33.2.2 2002/04/17 11:32:47 he Exp $       */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)getcap.c   8.3 (Berkeley) 3/25/94";
 #else
-__RCSID("$NetBSD: getcap.c,v 1.33.2.1 2001/10/26 18:06:41 jhawk Exp $");
+__RCSID("$NetBSD: getcap.c,v 1.33.2.2 2002/04/17 11:32:47 he Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -822,6 +822,8 @@
                /* 
                 * Line points to a name line.
                 */
+               if (len > sizeof(nbuf))
+                       return -1;
                done = 0;
                np = nbuf;
                for (;;) {
@@ -853,6 +855,8 @@
                                        line[len - 1] = '\0';
                        }
                }
+               if (len > sizeof(buf))
+                       return -1;
                rp = buf;
                for(cp = nbuf; *cp != '\0'; cp++)
                        if (*cp == '|' || *cp == ':')



Home | Main Index | Thread Index | Old Index