From e17334c3292be0b076aca35fed6e8544b620c1bf Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Thu, 23 Mar 1995 22:23:15 +0000 Subject: [PATCH] Don't let yp_match() or yp_next() operate on null or empty keys: asking ypserv to do a yp_match() with an a null or empty key causes much havok. (Note that this could be construed as a denial of service attack if used maliciously.) --- lib/libc/yp/yplib.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index 1187a664dc3..f9d881d9659 100644 --- a/lib/libc/yp/yplib.c +++ b/lib/libc/yp/yplib.c @@ -28,7 +28,7 @@ */ #ifndef LINT -static char *rcsid = "$Id: yplib.c,v 1.1 1994/08/07 23:04:55 wollman Exp $"; +static char *rcsid = "$Id: yplib.c,v 1.2 1995/03/21 00:48:55 wpaul Exp $"; #endif #include @@ -380,6 +380,11 @@ int *outvallen; *outval = NULL; *outvallen = 0; + /* Sanity check: no null keys allowed! */ + + if (inkey == NULL || *inkey == '\0') + return YPERR_KEY; + again: if( _yp_dobind(indomain, &ysd) != 0) return YPERR_DOMAIN; @@ -510,6 +515,11 @@ int *outvallen; *outkey = *outval = NULL; *outkeylen = *outvallen = 0; + /* Sanity check: no null keys allowed! */ + + if (inkey == NULL || *inkey == '\0') + return YPERR_KEY; + again: if( _yp_dobind(indomain, &ysd) != 0) return YPERR_DOMAIN;