PATCH: Fix crash in pcre_callout with numerical callout 0

Mikael Magnusson <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
We don't use numerical callouts at all, but not crashing is at least a more useful behavior. While it is true that callout_number is always 0 for string callouts, it is not true that it is never 0 for numerical callouts, so check that we got a string too.
---

 Src/Modules/pcre.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c
index 67157cc016..98b52f8de9 100644
--- a/Src/Modules/pcre.c
+++ b/Src/Modules/pcre.c
@@ -134,7 +134,7 @@ pcre_callout(pcre2_callout_block_8 *block, UNUSED(void *callout_data))
     Eprog prog;
     int ret=0;
 
-    if (!block->callout_number &&
+    if (!block->callout_number && block->callout_string &&
 	    ((prog = parse_string((char *) block->callout_string, 0))))
     {
 	int ef = errflag, lv = lastval;
-- 
2.38.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.