Subject: | Incorrect regex in presentation2wire |
I noticed this in presentation2wire when I was working on it, but didn't
think anything of it:
#backslash found
if ($presentation =~ /\G(\d\d\d)/gc) {
$wire.=pack("C",$1);
} elsif ($presentation =~
/\Gx([0..9a..fA..F][0..9a..fA..F])/gc){
$wire.=pack("H*",$1);
} elsif ($presentation =~ /\G([@().\\])/gc){
$wire .= $1;
}
Those [0..9a..fA..F] should be [0-9a-fA-F]. Right now they're matching
literal 0, 9, a, f, A, F and ., not the ranges that they should be matching.
I'm hesitant to just provide a fix for this code however, because that
could change how it interacts with people's data.
I'm guessing there's no test coverage for these behaviors either or we
would have seen failures.
This was broken in the original code before I modified it as well, but I
didn't trace it back to see what its intended purpose was.
--
Matthew Horsfall (alh)
http://dyn.com