[PATCH] 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
Fri Oct 14 11:23:06 UTC 2016


Review at  https://gerrit.osmocom.org/1064

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/64/1064/1

diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index 9743530..90dbcb8 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 + amr,
+				ARRAY_SIZE(lchan->tch.dtx.cache));
 
 	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: newchange
Gerrit-Change-Id: I2fbc468caedf08f26893457db7c7fbacef5b860c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list