diff options
author | B. Watson <urchlay@slackware.uk> | 2024-04-14 03:56:08 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-04-14 03:56:08 -0400 |
commit | 89b133dfb011ed453a6444b2f2d54eeba82a0216 (patch) | |
tree | f675ea748df695142bacf236f6813003ef039c76 | |
parent | 2ee0a695671ebaa4b3f1463b91071f67632eb551 (diff) | |
download | soxdial-89b133dfb011ed453a6444b2f2d54eeba82a0216.tar.gz |
soxdial: sanitize dial string in --verbose output.
-rwxr-xr-x | soxdial | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -770,10 +770,15 @@ for ($argc = 0; $argc < @ARGV; $argc++) { warn "$SELF: bluebox mode disabled (touchtone enabled).\n" if $verbose; } else { $_ = lc $_; + + # paranoia: in case we get non-printable characters, we don't want + # to print them in verbose mode (yes, I use /dev/urandom for testing). + ($printable = $_) =~ s,[^\x20-\x7e],.,g; + if($verbose && (/^--?[a-z]/i)) { - warn "$SELF: treating '$_' as a dial string (might be a typo?)\n"; + warn "$SELF: treating '$printable' as a dial string (might be a typo?)\n"; } - warn "$SELF: start dial string '$_'\n" if $verbose; + warn "$SELF: start dial string '$printable'\n" if $verbose; my $time_override; if($bluebox) { @@ -802,7 +807,7 @@ for ($argc = 0; $argc < @ARGV; $argc++) { warn "$SELF: no valid digits in dial string.\n" if $verbose; } - warn "$SELF: end dial string '$_'\n" if $verbose; + warn "$SELF: end dial string '$printable'\n" if $verbose; } } |