]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.3-20060315
authorWietse Venema <wietse@porcupine.org>
Wed, 15 Mar 2006 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:32:13 +0000 (06:32 +0000)
postfix/HISTORY
postfix/src/global/mail_version.h
postfix/src/util/dict_pcre.c
postfix/src/util/dict_pcre.ref

index 5ab5e8a0b3b3be5430aecb3601a2e247a21d7b76..49ea1850c7e191c1681ad9c59f200e762db42d54 100644 (file)
@@ -12043,6 +12043,13 @@ Apologies for any names omitted.
        longer manipulate the mail expiration schedule, so that
        mail "on hold" could expire too soon.
 
+20060315
+
+       Workaround. the PCRE library reports an inappropriate error
+       code (invalid substring) when $number refers to a valid ()
+       expression that matches the null string. This caused fatal
+       run-time errors.  File: dict_pcre.c.
+
 Wish list:
 
        The sendmail command should not return non-std exit status
index 7b3dd946c02e8c9794e1180d2b57381cbda7ca33..7b62eb05df45da96cc31291fa536c877777fd2cb 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20060313"
+#define MAIL_RELEASE_DATE      "20060315"
 #define MAIL_VERSION_NUMBER    "2.3"
 
 #ifdef SNAPSHOT
index 8a4d9ae628351a6691606a1e0334104bc89e253e..dd9f0c547ae59281dcea4a6cc59077ca994f1437 100644 (file)
@@ -178,8 +178,7 @@ static int dict_pcre_expand(int type, VSTRING *buf, char *ptr)
                                 ctxt->matches, n, &pp);
        if (ret < 0) {
            if (ret == PCRE_ERROR_NOSUBSTRING)
-               msg_fatal("regexp %s, line %d: replace index out of range",
-                         dict_pcre->dict.name, match_rule->rule.lineno);
+               return (MAC_PARSE_UNDEF);
            else
                msg_fatal("regexp %s, line %d: pcre_get_substring error: %d",
                        dict_pcre->dict.name, match_rule->rule.lineno, ret);
@@ -591,6 +590,7 @@ static DICT_PCRE_RULE *dict_pcre_parse_rule(const char *mapname, int lineno,
                                                    int dict_flags)
 {
     char   *p;
+    int     actual_sub;
 
     p = line;
 
@@ -662,6 +662,23 @@ static DICT_PCRE_RULE *dict_pcre_parse_rule(const char *mapname, int lineno,
         */
        if (dict_pcre_compile(mapname, lineno, &regexp, &engine) == 0)
            CREATE_MATCHOP_ERROR_RETURN(0);
+#ifdef PCRE_INFO_CAPTURECOUNT
+       if (pcre_fullinfo(engine.pattern, engine.hints,
+                         PCRE_INFO_CAPTURECOUNT,
+                         (void *) &actual_sub) != 0)
+           msg_panic("pcre map %s, line %d: pcre_fullinfo failed",
+                     mapname, lineno);
+       if (prescan_context.max_sub > actual_sub) {
+           msg_warn("regexp map %s, line %d: out of range replacement index \"%d\": "
+                    "skipping this rule", mapname, lineno,
+                    (int) prescan_context.max_sub);
+           if (engine.pattern)
+               myfree((char *) engine.pattern);
+           if (engine.hints)
+               myfree((char *) engine.hints);
+           CREATE_MATCHOP_ERROR_RETURN(0);
+       }
+#endif
 
        /*
         * Save the result.
index 8b2b894487d5e8c6726c637a45620697e86b3c4a..e7c04227de292ff22347b7c5bd5545700e7ddd39 100644 (file)
@@ -2,6 +2,7 @@
 ./dict_open: warning: pcre map dict_pcre.map, line 5: ignoring extra text after ENDIF
 ./dict_open: warning: pcre map dict_pcre.map, line 8: unknown regexp option "!": skipping this rule
 ./dict_open: warning: dict_pcre.map, line 9: no replacement text: using empty string
+./dict_open: warning: regexp map dict_pcre.map, line 10: out of range replacement index "5": skipping this rule
 ./dict_open: warning: pcre map dict_pcre.map, line 17: $number found in negative match replacement text: skipping this rule
 ./dict_open: warning: pcre map dict_pcre.map, line 22: no regexp: skipping this rule
 > get true