diff options
author | Max <msuraev@sysmocom.de> | 2016-10-14 13:21:04 +0200 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2016-10-17 08:11:01 +0000 |
commit | b0c1d21581f009e9509e0fd995c86d1785785c7a (patch) | |
tree | 24b3d78182c4355f259c553bc31434f90a96f4a2 | |
parent | 21142f789812553b56f493d79184f5a31ab7b1cd (diff) |
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
-rw-r--r-- | src/common/msg_utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |