summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex/regcomp.c
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2017-10-30 06:48:20 +0000
committerotto <otto@openbsd.org>2017-10-30 06:48:20 +0000
commit25bee7e617fe3b722ecfc66dd9214423b9581849 (patch)
tree1500b073b544e84248f8d5c273d1f90e9eb17848 /lib/libc/regex/regcomp.c
parentadd regress tests for new vmd bridge handling code (diff)
downloadwireguard-openbsd-25bee7e617fe3b722ecfc66dd9214423b9581849.tar.xz
wireguard-openbsd-25bee7e617fe3b722ecfc66dd9214423b9581849.zip
fix oob read; form llvm via Vlad Tsyrklevich; ok millert@
Diffstat (limited to 'lib/libc/regex/regcomp.c')
-rw-r--r--lib/libc/regex/regcomp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index 4feb2747b83..19c86cc4c39 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: regcomp.c,v 1.31 2016/12/22 00:09:07 krw Exp $ */
+/* $OpenBSD: regcomp.c,v 1.32 2017/10/30 06:48:20 otto Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
@@ -823,7 +823,7 @@ p_b_coll_elem(struct parse *p,
{
char *sp = p->next;
struct cname *cp;
- int len;
+ size_t len;
while (MORE() && !SEETWO(endc, ']'))
NEXT();
@@ -833,7 +833,7 @@ p_b_coll_elem(struct parse *p,
}
len = p->next - sp;
for (cp = cnames; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
+ if (strncmp(cp->name, sp, len) == 0 && strlen(cp->name) == len)
return(cp->code); /* known name */
if (len == 1)
return(*sp); /* single character */