From c8a67d26ec65a86d7d7d81969a0d5132215f2e6e Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Thu, 26 May 2016 14:17:58 +0000 Subject: Fix an oversight that caused the test program to segfault: Don't try to calculate strlen(NULL). --- src/regress/lib/libc/regex/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regress/lib/libc/regex/main.c b/src/regress/lib/libc/regex/main.c index 92257a7179..73334fa4ce 100644 --- a/src/regress/lib/libc/regex/main.c +++ b/src/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 @@ -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); -- cgit v1.2.3-55-g6feb