]> git.donarmstrong.com Git - debbugs.git/commitdiff
Fix unescaped From in bugreport (closes: #983847)
authorDon Armstrong <don@donarmstrong.com>
Sun, 7 Mar 2021 16:38:15 +0000 (08:38 -0800)
committerDon Armstrong <don@donarmstrong.com>
Thu, 11 Mar 2021 01:04:09 +0000 (17:04 -0800)
cgi/bugreport.cgi
debian/changelog
t/07_bugreport.t

index 51744b2760a9d8b5e7038f6edbe4a78e5c89799f..b50906de29bb8712f4f1f001756f61e340e57f04 100755 (executable)
@@ -291,7 +291,11 @@ END
          print map { s/^(>*From )/>$1/; $_."\n" } @lines[ 1 .. $#lines ];
       if ($record->{inner_file}) {
           my $fh = $record->{fh};
-          print $_ while (<$fh>);
+          local $/;
+          while (<$fh>) {
+              s/^(>*From )/>$1/gm;
+              print $_;
+          }
       }
      }
      exit 0;
index 263c968a5d6dc98d0d16bb0cb8a412b8cb339d02..be7e73a47afa3451cc4171fa9485a30e212abfa5 100644 (file)
@@ -1,6 +1,7 @@
 debbugs (2.6.1) unstable; urgency=medium
 
   * Add support for a Done: psuedoheader (closes: #950133)
+  * Fix unescaped From (closes: #983847)
 
  -- Don Armstrong <don@debian.org>  Fri, 09 Mar 2018 11:17:10 -0800
 
index dfc1650c2dfd954df7249cc2f191c7cb6b068072..26da39abe861d5a5bd2224fea2edfc96007cdbc1 100644 (file)
@@ -1,7 +1,7 @@
 # -*- mode: cperl;-*-
 
 
-use Test::More tests => 18;
+use Test::More tests => 19;
 
 use warnings;
 use strict;
@@ -37,7 +37,9 @@ send_message(to=>'submit@bugs.something',
 Package: foo
 Severity: normal
 
-This is a silly bug
+This is a silly bug which contains an unescaped From line.
+
+From line
 EOF
 
 
@@ -91,6 +93,9 @@ ok($mech->content() =~ qr/Subject: Submitting a bug/i,
    'Subject of bug maibox is right');
 ok($mech->content() =~ qr/^From /m,
    'Starts with a From appropriately');
+ok($mech->content() =~ qr/^(>F|=46)rom line/m,
+   'From line escaped appropriately');
+print STDERR $mech->content();
 
 $mech->get_ok('http://localhost:'.$port.'/?bug=1;mboxmaint=yes',
               'Page received ok');