From 65f422ad5878165be0a1eb05605aa3099536f0c8 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 17 Sep 2018 12:22:10 +0200 Subject: 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: I5908ee44404686e68d61f255b7014af39c8f5703 --- openbsc/src/libmgcp/mgcp_osmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/src') diff --git a/openbsc/src/libmgcp/mgcp_osmux.c b/openbsc/src/libmgcp/mgcp_osmux.c index 8a802f53c..ca0ed30e3 100644 --- a/openbsc/src/libmgcp/mgcp_osmux.c +++ b/openbsc/src/libmgcp/mgcp_osmux.c @@ -545,7 +545,7 @@ int osmux_send_dummy(struct mgcp_endpoint *endp) } /* bsc-nat allocates/releases the Osmux circuit ID */ -static uint8_t osmux_cid_bitmap[(OSMUX_CID_MAX + 1) / 8]; +static uint8_t osmux_cid_bitmap[(OSMUX_CID_MAX + 7) / 8]; int osmux_used_cid(void) { -- cgit v1.2.3