summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2002-07-31 22:28:32 +0000
committerderaadt <deraadt@openbsd.org>2002-07-31 22:28:32 +0000
commit0ffb34fd82248fc325d5018caf23a374bb680db8 (patch)
treea0c588bf532c0ed05a16daed3d611e4647bbcf38 /lib
parentWhen I got removed the use of atexit() I missed the fact that edit() (diff)
downloadwireguard-openbsd-0ffb34fd82248fc325d5018caf23a374bb680db8.tar.xz
wireguard-openbsd-0ffb34fd82248fc325d5018caf23a374bb680db8.zip
if ypmatch_add sees short keys or values, abort early
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/yp/ypmatch_cache.c5
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)