From a42f99ca7ae8c4ed2d93c6fafc5953637d5a75f5 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 31 Jul 2002 22:28:33 +0000 Subject: if ypmatch_add sees short keys or values, abort early --- lib/libc/yp/ypmatch_cache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libc/yp/ypmatch_cache.c b/lib/libc/yp/ypmatch_cache.c index 2800bf35542..43796faede1 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.8 2002/07/20 01:35:35 deraadt Exp $"; +static char *rcsid = "$OpenBSD: ypmatch_cache.c,v 1.9 2002/07/31 22:28:32 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -59,6 +59,9 @@ ypmatch_add(const char *map, const char *key, u_int keylen, char *val, struct ypmatch_ent *ep; time_t t; + if (keylen == 0 || vallen == 0) + return (0); + (void)time(&t); for (ep = ypmc; ep; ep = ep->next) -- cgit v1.2.3