summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-05-26 14:17:59 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-05-26 14:17:59 +0000
commit87f3344ca7257e2acd86d48c4c533dbeba340393 (patch)
treef61bb614eb4b8957ffe312ef53e8f02de503155e /regress/lib
parent1e29e36ede60aed20d2f10437ec8d80528fa17cd (diff)
Fix an oversight that caused the test program to segfault:
Don't try to calculate strlen(NULL).
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libc/regex/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/regress/lib/libc/regex/main.c b/regress/lib/libc/regex/main.c
index 92257a71797..73334fa4ceb 100644
--- a/regress/lib/libc/regex/main.c
+++ b/regress/lib/libc/regex/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.8 2016/05/26 13:33:53 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.9 2016/05/26 14:17:58 schwarze Exp $ */
/* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */
#include <stdio.h>
@@ -454,7 +454,6 @@ char *should;
}
len = (int)(sub.rm_eo - sub.rm_so);
- shlen = (int)strlen(should);
p = str + sub.rm_so;
/* check for not supposed to match */
@@ -464,6 +463,7 @@ char *should;
}
/* check for wrong match */
+ shlen = (int)strlen(should);
if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
snprintf(grump, sizeof grump, "matched `%.*s' instead", len, p);
return(grump);