[MERGED] osmo-bts[master]: DTX AMR - fix buffer length check

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Mon Oct 17 08:13:52 UTC 2016


Max has submitted this change and it was merged.

Change subject: DTX AMR - fix buffer length check
......................................................................


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
---
M src/common/msg_utils.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index 09596f3..f00a71a 100644
--- a/src/common/msg_utils.c
+++ b/src/common/msg_utils.c
@@ -112,7 +112,8 @@
 		       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;

-- 
To view, visit https://gerrit.osmocom.org/1064
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2fbc468caedf08f26893457db7c7fbacef5b860c
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list