Change in osmo-mgw[master]: mgcp: Fix osmux_cid_bitmap static array size calculation

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Sep 17 10:41:57 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/10995


Change subject: mgcp: Fix osmux_cid_bitmap static array size calculation
......................................................................

mgcp: Fix osmux_cid_bitmap static array size calculation

Right now it's not a big issue since OSMUX_CID_MAX is 255, so 255+1 is
256 which fits array boundaries correctly (multiple of 8). However, if
for example OSMUC_CID_MAX was modified to be 12, 12+1/8 = 1, so we'd
have an undesired memory access when accessing last 4 CIDs.

Change-Id: Iaf9b93712dbd2a862b01e70dd8e11893bfa6b24c
---
M src/libosmo-mgcp/mgcp_osmux.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/95/10995/1

diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 26817c8..f9ab839 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -656,7 +656,7 @@
 }
 
 /*! bsc-nat allocates/releases the OSMUX cids (Circuit IDs). */
-static uint8_t osmux_cid_bitmap[(OSMUX_CID_MAX + 1) / 8];
+static uint8_t osmux_cid_bitmap[(OSMUX_CID_MAX + 7) / 8];
 
 /*! count the number of taken OSMUX cids.
  *  \returns number of OSMUX cids in use */

-- 
To view, visit https://gerrit.osmocom.org/10995
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf9b93712dbd2a862b01e70dd8e11893bfa6b24c
Gerrit-Change-Number: 10995
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180917/d2c2ffa0/attachment.htm>


More information about the gerrit-log mailing list