From 6d51b3afc7b344db932533cb6c99b208628a2f22 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 5 Feb 2021 13:37:59 +0100 Subject: [PATCH] TT#108003 Fix off-by-one check dtmf_samples() The dtmf_freqs array contains one less element than the check was allowing for. Change-Id: I783fa6bcd0bd79fad9886ee53e7a990e504ecff8 Warned-by: coverity --- lib/dtmflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dtmflib.c b/lib/dtmflib.c index 9289224ed..466d8efbe 100644 --- a/lib/dtmflib.c +++ b/lib/dtmflib.c @@ -47,7 +47,7 @@ void dtmf_samples(void *buf, unsigned long offset, unsigned long num, unsigned i return; } - if (event > G_N_ELEMENTS(dtmf_freqs)) { + if (event >= G_N_ELEMENTS(dtmf_freqs)) { ilog(LOG_WARN | LOG_FLAG_LIMIT, "Unsupported DTMF event %u", event); memset(buf, 0, num * 2); return;