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 OSMUX_CID_MAX was modified to be 12, 12+1/8 = 1, so we'd have an undesired memory access when accessing last 4 CIDs. A +1 should be kept on top, because OSMUX_CID_MAX specified the maximum number used by a CID, that is (0,OSMUX_CID_MAX), and as a result we require OSMUX_CID_MAX+1 slots. Change-Id: Iaf9b93712dbd2a862b01e70dd8e11893bfa6b24c
This commit is contained in:
parent
956242dcec
commit
bcd52e5724
|
@ -655,8 +655,8 @@ int osmux_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn)
|
|||
htons(endp->cfg->osmux_port), buf, sizeof(buf));
|
||||
}
|
||||
|
||||
/*! bsc-nat allocates/releases the OSMUX cids (Circuit IDs). */
|
||||
static uint8_t osmux_cid_bitmap[(OSMUX_CID_MAX + 1) / 8];
|
||||
/* bsc-nat allocates/releases the Osmux circuit ID. +7 to round up to 8 bit boundary. */
|
||||
static uint8_t osmux_cid_bitmap[(OSMUX_CID_MAX + 1 + 7) / 8];
|
||||
|
||||
/*! count the number of taken OSMUX cids.
|
||||
* \returns number of OSMUX cids in use */
|
||||
|
|
Loading…
Reference in New Issue