diff options
author | 2016-05-26 14:17:58 +0000 | |
---|---|---|
committer | 2016-05-26 14:17:58 +0000 | |
commit | 7d7ae6607fa5bbc410f4cd4503449fb3edeb306a (patch) | |
tree | 29bff4fb7e48a90f79be70bc6dcf55d484d704c0 | |
parent | systematically test all combinations of REG_STARTEND, REG_NEWLINE, (diff) | |
download | wireguard-openbsd-7d7ae6607fa5bbc410f4cd4503449fb3edeb306a.tar.xz wireguard-openbsd-7d7ae6607fa5bbc410f4cd4503449fb3edeb306a.zip |
Fix an oversight that caused the test program to segfault:
Don't try to calculate strlen(NULL).
-rw-r--r-- | regress/lib/libc/regex/main.c | 4 |
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); |