diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-31 22:28:33 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-31 22:28:33 +0000 |
commit | a42f99ca7ae8c4ed2d93c6fafc5953637d5a75f5 (patch) | |
tree | 46175375653bb799da3d139b871945b6cc88a65e | |
parent | a307fd5af8a64e548d9c1607e22f1849dd79a745 (diff) |
if ypmatch_add sees short keys or values, abort early
-rw-r--r-- | lib/libc/yp/ypmatch_cache.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 <sys/param.h> @@ -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) |