X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cgi%2Fbugreport.cgi;h=de4ec76371633cfe8d9760a14a7f6e2142df6250;hb=31ab1899c89be7bdafb7626b8f1fb3fff5ef5838;hp=8692146485297e70cf3bd9e83f255c16056d028e;hpb=b7e8647009f0aad9689e88d13a13341b5e7ad83a;p=debbugs.git diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 8692146..de4ec76 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -1,8 +1,16 @@ -#!/usr/bin/perl -wT +#!/usr/bin/perl use warnings; use strict; +# Sanitize environent for taint +BEGIN{ + delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; +} + +# STDOUT should be using the utf8 io layer +binmode(STDOUT,':utf8'); + use POSIX qw(strftime); use MIME::Parser; use MIME::Decoder; @@ -163,6 +171,7 @@ if (defined($msg) and ($msg-1) <= $#records) { } my @log; if ( $mbox ) { + binmode(STDOUT,":raw"); my $date = strftime "%a %b %d %T %Y", localtime; if (@records > 1) { print $q->header(-type => "text/plain", @@ -237,6 +246,7 @@ END else { if (defined $att and defined $msg and @records) { + binmode(STDOUT,":raw"); $msg_num++; print handle_email_message($records[0]->{text}, ref => $ref,