Skip Menu |

This queue is for tickets about the Net-SIP CPAN distribution.

Report information
The Basics
Id: 29153
Status: resolved
Priority: 0/
Queue: Net-SIP

People
Owner: Nobody in particular
Requestors: polettix [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.32
Fixed in: (no value)



Subject: StatelessProxy: red flag on regular expression usage
Hi, I was perusing the code for Net::SIP::StatelessProxy and noticed something that could lead to nasty bugs. In particular: if ( $to =~m{^(.*?)(\w+)(\@.*)} && ( my $back = invoke_callback( $rewrite_contact,$2 ) )) { $to = $1.$back; relies on the fact that the callback does not modify $1, i.e. it does not use capturing regexes. I'd rather rewrite it like this (note: not tested): if ( ( my ($pre, $name, $rest) = $to =~ m{^(.*?)(\w+)(\@.*)} ) && ( my $back = invoke_callback( $rewrite_contact, $2 ) ) ) { $to = $pre . $back; This ensures that $1 can be modified at will, while retaining the captured value in $pre. Hope this helps, Flavio.
Hi Flavio, Thanks for you bug report and patch. I've fixed the bug in Version 0.33. Regards, Steffen