Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/gen/getcap.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libc/gen/getcap.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.33.4.1 retrieving revision 1.39 diff -u -p -r1.33.4.1 -r1.39 --- src/lib/libc/gen/getcap.c 2001/10/08 20:18:55 1.33.4.1 +++ src/lib/libc/gen/getcap.c 2003/10/27 00:12:42 1.39 @@ -1,4 +1,4 @@ -/* $NetBSD: getcap.c,v 1.33.4.1 2001/10/08 20:18:55 nathanw Exp $ */ +/* $NetBSD: getcap.c,v 1.39 2003/10/27 00:12:42 lukem Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -15,11 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -36,17 +32,22 @@ * SUCH DAMAGE. */ +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + #include #if defined(LIBC_SCCS) && !defined(lint) #if 0 static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94"; #else -__RCSID("$NetBSD: getcap.c,v 1.33.4.1 2001/10/08 20:18:55 nathanw Exp $"); +__RCSID("$NetBSD: getcap.c,v 1.39 2003/10/27 00:12:42 lukem Exp $"); #endif #endif /* LIBC_SCCS and not lint */ #include "namespace.h" #include +#include #include #include @@ -251,7 +252,7 @@ getent(cap, len, db_array, fd, name, dep size_t clen; char *record, *cbuf, *newrecord; int tc_not_resolved; - char pbuf[_POSIX_PATH_MAX]; + char pbuf[MAXPATHLEN]; _DIAGASSERT(cap != NULL); _DIAGASSERT(len != NULL); @@ -822,6 +823,8 @@ cgetnext(bp, db_array) /* * Line points to a name line. */ + if (len > sizeof(nbuf)) + return -1; done = 0; np = nbuf; for (;;) { @@ -853,6 +856,8 @@ cgetnext(bp, db_array) line[len - 1] = '\0'; } } + if (len > sizeof(buf)) + return -1; rp = buf; for(cp = nbuf; *cp != '\0'; cp++) if (*cp == '|' || *cp == ':')