Fix regext substring capture variables for null matches. Bug 2933
[exim.git] / src / src / exim.c
index b3fd9eff0a3782cb402c925e265ddf5e2f129bb1..47a685aa7b45da1c66fc6402625874b38dd3d1aa 100644 (file)
@@ -134,6 +134,8 @@ if ((yield = (res >= 0)))
     PCRE2_SIZE len;
     pcre2_substring_get_bynumber(md, matchnum,
       (PCRE2_UCHAR **)&expand_nstring[expand_nmax], &len);
+    if (!expand_nstring[expand_nmax])
+      { expand_nstring[expand_nmax] = US""; len = 0; }
     expand_nlength[expand_nmax++] = (int)len;
     }
   expand_nmax--;