Prevent corruption of SIP messages in logs
authorDan Scott <dscott@laurentian.ca>
Wed, 15 Jun 2011 19:17:31 +0000 (15:17 -0400)
committerThomas Berezansky <tsbere@mvlc.org>
Wed, 15 Jun 2011 20:31:22 +0000 (16:31 -0400)
Non-ASCII characters were not being decoded before being
written to the logs, thus resulting in heinous corruption
in the logs. decode_utf8() is our friend.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Sip.pm

diff --git a/Sip.pm b/Sip.pm
index 065e7ff..1e57916 100644 (file)
--- a/Sip.pm
+++ b/Sip.pm
@@ -167,7 +167,7 @@ sub read_SIP_packet {
     {    # adapted from http://perldoc.perl.org/5.8.8/functions/readline.html
         for ( my $tries = 1 ; $tries <= 3 ; $tries++ ) {
             undef $!;
-            $record = readline($fh);
+            $record = decode_utf8(readline($fh));
             if ( defined($record) ) {
                 while ( chomp($record) ) { 1; }
                 $len1 = length($record);