summaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-08-13 19:11:34 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-08-13 19:11:34 +0200
commitf8ffc1b1d7790cf56cb7f766104243186d990a3a (patch)
tree04d09200b0093872000ad36104214575abb1f741 /src/audio.c
parentcf64bac11989e8b2f13e1a6f8bb7cb2b579a44e1 (diff)
audio: check that DTMF key is valid
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/audio.c b/src/audio.c
index f330864..c204755 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -1318,10 +1318,17 @@ int audio_send_digit(struct audio *a, char key)
return EINVAL;
if (key != KEYCODE_REL) {
+ int event = telev_digit2code(key);
info("audio: send DTMF digit: '%c'\n", key);
- err = telev_send(a->telev, telev_digit2code(key), false);
+
+ if (event == -1) {
+ warning("audio: invalid DTMF digit (0x%02x)\n", key);
+ return EINVAL;
+ }
+
+ err = telev_send(a->telev, event, false);
}
- else if (a->tx.cur_key != KEYCODE_REL) {
+ else if (a->tx.cur_key && a->tx.cur_key != KEYCODE_REL) {
/* Key release */
info("audio: send DTMF digit end: '%c'\n", a->tx.cur_key);
err = telev_send(a->telev,