From b0c1d21581f009e9509e0fd995c86d1785785c7a Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 14 Oct 2016 13:21:04 +0200 Subject: DTX AMR - fix buffer length check Consider AMR-specific prefix in computing max length to avoid triggering coverity check. Change-Id: I2fbc468caedf08f26893457db7c7fbacef5b860c Fixes: Coverity CID 150133 --- src/common/msg_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index 09596f36..f00a71ac 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -112,7 +112,8 @@ void dtx_cache_payload(struct gsm_lchan *lchan, const uint8_t *l1_payload, size_t length, uint32_t fn, int update) { size_t amr = (update < 0) ? 0 : 2, - copy_len = OSMO_MIN(length + 1, ARRAY_SIZE(lchan->tch.dtx.cache)); + copy_len = OSMO_MIN(length + 1, + ARRAY_SIZE(lchan->tch.dtx.cache) - amr); lchan->tch.dtx.len = copy_len + amr; lchan->tch.dtx.fn = fn; -- cgit v1.2.3