Skip to content

Commit eb66327

Browse files
committed
pcre2_string_utils: avoid segfault with strlen(NULL)
As the first step towards allowing a NULL string to represent an empty one, and as an alternative fix for the failures addressed by PCRE2Project#53
1 parent eb42305 commit eb66327

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/pcre2_string_utils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ PCRE2_SIZE
209209
PRIV(strlen)(PCRE2_SPTR str)
210210
{
211211
PCRE2_SIZE c = 0;
212+
if (str == NULL) return 0;
212213
while (*str++ != 0) c++;
213214
return c;
214215
}

0 commit comments

Comments
 (0)