Subject: | Net::SIP::Util sip_parts2hdrval encoding of special characters |
Date: | Tue, 9 May 2017 14:32:37 +0000 |
To: | "bug-Net-SIP [...] rt.cpan.org" <bug-Net-SIP [...] rt.cpan.org> |
From: | Richard Carver <richard.carver [...] cloudmont.co.uk> |
When calling the sip_parts2hdrval function with a parameter that contains a '%' character it triggers an extra encoding, but because the 'e' is missing off the expression it causes the literal 'sprintf "%%%02x",ord($1)' to be inserted into the resultant string.
*** /usr/local/share/perl5/Net/SIP/Util.pm.orig
--- /usr/local/share/perl5/Net/SIP/Util.pm
*************** sub sip_parts2hdrval {
*** 189,195 ****
my $v = $param->{$k};
if ( defined $v ) {
# escape special chars
! $v =~s{([%\r\n\t"[:^print:]])}{ sprintf "%%%02x",ord($1) }sg;
$v = '"'.$v.'"' if $v =~m{\s|$delim};
$val .= '='.$v
}
--- 189,195 ----
my $v = $param->{$k};
if ( defined $v ) {
# escape special chars
! $v =~s{([%\r\n\t"[:^print:]])}{ sprintf "%%%02x",ord($1) }sge;
$v = '"'.$v.'"' if $v =~m{\s|$delim};
$val .= '='.$v
}