aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-04-14 03:56:08 -0400
committerB. Watson <urchlay@slackware.uk>2024-04-14 03:56:08 -0400
commit89b133dfb011ed453a6444b2f2d54eeba82a0216 (patch)
treef675ea748df695142bacf236f6813003ef039c76
parent2ee0a695671ebaa4b3f1463b91071f67632eb551 (diff)
downloadsoxdial-89b133dfb011ed453a6444b2f2d54eeba82a0216.tar.gz
soxdial: sanitize dial string in --verbose output.
-rwxr-xr-xsoxdial11
1 files changed, 8 insertions, 3 deletions
diff --git a/soxdial b/soxdial
index 6036e2b..5e6c808 100755
--- a/soxdial
+++ b/soxdial
@@ -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;
}
}