summaryrefslogtreecommitdiff
path: root/lib/libc/regex
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2017-10-30 06:48:21 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2017-10-30 06:48:21 +0000
commit2be5a74cbb8ec64bcb444b5c8e5783d9f3647c61 (patch)
tree7111745a230b44b009950606fd5ca417a7bad3c5 /lib/libc/regex
parent3c5cc49a3943e586476dce492c321197425a885b (diff)
fix oob read; form llvm via Vlad Tsyrklevich; ok millert@
Diffstat (limited to 'lib/libc/regex')
-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 */