while (@lines){
$msg = shift @lines;
- $msg =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
+ $msg =~ s/\%([2-9A-F][0-9A-F])/chr(hex($1))/eg;
+ $msg =~ s/[\x00-\x08\x0a-\x1f\x80-\x9f]/./g; # immutable CSI sequence + control characters
&{$conn->{rcvd_notification_proc}}($conn, $msg, $!);
$! = 0;
}