summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2008-02-23 08:13:07 +0000
committerotto <otto@openbsd.org>2008-02-23 08:13:07 +0000
commitae541f995cd61ce145c416fdd93dc8c2f75b0970 (patch)
tree079b05352e05d001d10bc5324b9b44118d6a90e3 /lib/libc
parentSupport for specifying aes-{128,192,256}. Originial idea by Prabhu (diff)
downloadwireguard-openbsd-ae541f995cd61ce145c416fdd93dc8c2f75b0970.tar.xz
wireguard-openbsd-ae541f995cd61ce145c416fdd93dc8c2f75b0970.zip
if the first call to allocset() fails, the second might deref a NULL
pointer, so add a safety-net. From Gianluigi Tiesi via Torok Edwin. ok chl@ millert@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/regex/regcomp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index 022e20da32b..5b632c8b7dd 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: regcomp.c,v 1.18 2007/10/10 21:23:44 chl Exp $ */
+/* $OpenBSD: regcomp.c,v 1.19 2008/02/23 08:13:07 otto Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
@@ -1051,6 +1051,9 @@ allocset(struct parse *p)
(void) memset((char *)p->g->setbits + (nbytes - css), 0, css);
}
+ /* XXX should not happen */
+ if (p->g->sets == NULL || p->g->setbits == NULL)
+ goto nomem;
cs = &p->g->sets[no];
cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);