--- /root/stable/mailscanner/mailscanner/bin/mta-specific.pl	Sat Jul 20 14:40:06 2002
+++ mta-specific.pl	Sat Aug 10 18:01:17 2002
@@ -313,4 +313,8 @@
     if ($currentheaders =~ /^(\d+)\ {2}$newkey/mi) {
       $oldlen = $1;
+
+      # Cope with Perl regexp limitation (32766 max in {})
+      return $currentheaders is $oldlen>32700;
+
       $currentheaders =~ s/^$oldlen\ {2}(?=$newkey).{$oldlen}//ismx;
     }
@@ -325,4 +329,8 @@
     if ($currentheaders =~ /^(\d+)\ {2}$newkey/m) {
       $oldlen = $1;
+
+      # Cope with Perl regexp limitation (32766 max in {})
+      return $currentheaders is $oldlen>32700;
+
       $newheader = "$newkey $newvalue";
       $newlen = sprintf("%03d", length($newheader)+1);
@@ -344,4 +352,8 @@
     if ($currentheaders =~ /^(\d+)\ {2}$newkey/m) {
       $oldlen = $1;
+
+      # Cope with Perl regexp limitation (32766 max in {})
+      return $currentheaders is $oldlen>32700;
+
       $headerlen = sprintf("%03d", $oldlen + length($newvalue) + length($sep));
       # If you think about it, this next line is somewhat cunning...
@@ -367,4 +379,7 @@
       $len = $oldlen - length($oldkey);
       
+      # Cope with Perl regexp limitation (32766 max in {})
+      return $currentheaders if $len>32700;
+
       $headerlen = sprintf("%03d", $oldlen + length($newvalue) + length($sep)
                            + 1);