summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-01-20 18:40:28 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-01-20 18:40:28 +0000
commit0a8f2cc87f99deec610ef91696850a249bd8fb81 (patch)
tree42c90ba92da2c626d1b23e412f2f8a5f9aa593b4 /lib
parentea66ae2f74cdf7205680ea10a778732d1f2173b6 (diff)
for yp_match() and yp_next(), do not permit keys longer than YPMAXRECORD
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/yp/ypmatch_cache.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/yp/ypmatch_cache.c b/lib/libc/yp/ypmatch_cache.c
index 4f3e5d36d86..2c04db26c34 100644
--- a/lib/libc/yp/ypmatch_cache.c
+++ b/lib/libc/yp/ypmatch_cache.c
@@ -30,7 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: ypmatch_cache.c,v 1.6 1996/12/03 08:20:06 deraadt Exp $";
+static char *rcsid = "$OpenBSD: ypmatch_cache.c,v 1.7 1998/01/20 18:40:27 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -167,7 +167,7 @@ yp_match(indomain, inmap, inkey, inkeylen, outval, outvallen)
if (indomain == NULL || *indomain == '\0' ||
strlen(indomain) > YPMAXDOMAIN || inmap == NULL ||
*inmap == '\0' || strlen(inmap) > YPMAXMAP ||
- inkey == NULL || inkeylen == 0)
+ inkey == NULL || inkeylen == 0 || inkeylen >= YPMAXRECORD)
return YPERR_BADARGS;
*outval = NULL;
@@ -250,7 +250,8 @@ yp_next(indomain, inmap, inkey, inkeylen, outkey, outkeylen, outval, outvallen)
if (indomain == NULL || *indomain == '\0' ||
strlen(indomain) > YPMAXDOMAIN || inmap == NULL ||
- *inmap == '\0' || strlen(inmap) > YPMAXMAP)
+ *inmap == '\0' || strlen(inmap) > YPMAXMAP ||
+ inkeylen == 0 || inkeylen >= YPMAXRECORD)
return YPERR_BADARGS;
*outkey = *outval = NULL;