Check for NULL replacement in pcre2_substitute()
This commit is contained in:
parent
2a294ddadb
commit
7ab2769728
|
@ -32,6 +32,8 @@ substituting.
|
||||||
|
|
||||||
11. Add check for NULL subject to POSIX regexec() function.
|
11. Add check for NULL subject to POSIX regexec() function.
|
||||||
|
|
||||||
|
12. Add check for NULL replacement to pcre2_substitute().
|
||||||
|
|
||||||
|
|
||||||
Version 10.39 29-October-2021
|
Version 10.39 29-October-2021
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
|
@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
|
||||||
|
|
||||||
Written by Philip Hazel
|
Written by Philip Hazel
|
||||||
Original API code Copyright (c) 1997-2012 University of Cambridge
|
Original API code Copyright (c) 1997-2012 University of Cambridge
|
||||||
New API code Copyright (c) 2016-2020 University of Cambridge
|
New API code Copyright (c) 2016-2021 University of Cambridge
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -261,9 +261,9 @@ if ((options & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) != 0)
|
||||||
return PCRE2_ERROR_BADOPTION;
|
return PCRE2_ERROR_BADOPTION;
|
||||||
|
|
||||||
/* Validate length and find the end of the replacement. */
|
/* Validate length and find the end of the replacement. */
|
||||||
if (replacement == NULL && rlength > 0) return PCRE2_ERROR_NULL;
|
|
||||||
else if (rlength == PCRE2_ZERO_TERMINATED)
|
if (replacement == NULL) return PCRE2_ERROR_NULL;
|
||||||
rlength = PRIV(strlen)(replacement);
|
if (rlength == PCRE2_ZERO_TERMINATED) rlength = PRIV(strlen)(replacement);
|
||||||
repend = replacement + rlength;
|
repend = replacement + rlength;
|
||||||
|
|
||||||
/* Check for using a match that has already happened. Note that the subject
|
/* Check for using a match that has already happened. Note that the subject
|
||||||
|
|
Loading…
Reference in New Issue