diff options
author | 2008-02-23 08:13:07 +0000 | |
---|---|---|
committer | 2008-02-23 08:13:07 +0000 | |
commit | ae541f995cd61ce145c416fdd93dc8c2f75b0970 (patch) | |
tree | 079b05352e05d001d10bc5324b9b44118d6a90e3 /lib/libc/regex/regcomp.c | |
parent | Support for specifying aes-{128,192,256}. Originial idea by Prabhu (diff) | |
download | wireguard-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/regex/regcomp.c')
-rw-r--r-- | lib/libc/regex/regcomp.c | 5 |
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); |