From f8ffc1b1d7790cf56cb7f766104243186d990a3a Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sat, 13 Aug 2016 19:11:34 +0200 Subject: audio: check that DTMF key is valid --- src/audio.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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, -- cgit v1.2.3