mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib readmail.pl,2.43,2.44

2014-04-20 19:56:00
Update of mhonarc/MHonArc/lib
Modified Files:
	readmail.pl 
Log Message:
Fix to RFC 2184 attribute parts parsing bug discovered by Ken Hornstein.
Bug causes Perl to abour execution, hence preventing any archive updates to
happen.


======================================================================
FILE: mhonarc/MHonArc/lib/readmail.pl
<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/*checkout*/mhonarc/MHonArc/lib/readmail.pl?rev=2.44>

<http://www.mhonarc.org/cgi-bin/viewcvs.cgi/mhonarc/MHonArc/lib/readmail.pl.diff?r1=2.43&r2=2.44&diff_format=h>
--- readmail.pl	29 Jan 2012 19:45:55 -0000	2.43
+++ readmail.pl	21 Apr 2014 00:55:55 -0000	2.44
@@ -1054,5 +1054,5 @@
     my $parm    = { };
     my @toks    = MHonArc::RFC822::uncomment($str);
-    my($tok, $name, $value, $charset, $lang, $part);
+    my($tok, $name, $value, $charset, $lang, $isPart);
 
     $parm->{'x-main'} = shift @toks  if $hasmain;
@@ -1072,14 +1072,13 @@
         ## Check if parameter is only part
         if ($name =~ s/\*(\d+)$//) {
-            $part = $1 - 1;     # we start at 0 internally
+            $isPart = 1;
         } else {
-            $part = 0;
+            $isPart = 0;
         }
         ## Set values for parameter
         $name = lc $name;
-        $parm->{$name} = {
-            'charset'   => $charset,
-            'lang'      => $lang,
-        };
+        $parm->{$name} = {}  unless defined($parm->{$name});
+        $parm->{$name}{'charset'} = $charset;
+        $parm->{$name}{'lang'} = $lang;
         ## Check if value is next token
         if ($value eq "") {
@@ -1088,5 +1087,9 @@
             $value =~ s/^"//;  $value =~ s/"$//;  $value =~ s/\\//g;
         }
-        $parm->{$name}{'vlist'}[$part] = $value;
+        if ($isPart && defined($parm->{$name}{'vlist'})) {
+          push(@{$parm->{$name}{'vlist'}}, $value);
+        } else {
+          $parm->{$name}{'vlist'} = [ $value ];
+        }
     }
 

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-COMMITS