[XS] Change in libosmocore[master]: cbsp: cbsp_decode_cell_list(): check *buf/len
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/44159?usp=email ) Change subject: cbsp: cbsp_decode_cell_list(): check *buf/len ...................................................................... cbsp: cbsp_decode_cell_list(): check *buf/len The callers of this function pass *buf/len as follows: cbsp_decode_cell_list(..., TLVP_VAL(tp, CBSP_IEI_CELL_LIST), TLVP_LEN(tp, CBSP_IEI_CELL_LIST)); so the *buf is NULL if the Cell List IE is not present. The IE length is also not guaranteed to be valid: it can be 0. Thus we should not be dereferencing the *buf unconditionally. Change-Id: I31c66fad36f380fb6706a935df412fd6114f4cd9 Fixes: OS#7097 --- M src/gsm/cbsp.c 1 file changed, 8 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/cbsp.c b/src/gsm/cbsp.c index bc8bc4f..b355eef 100644 --- a/src/gsm/cbsp.c +++ b/src/gsm/cbsp.c @@ -509,6 +509,14 @@ const uint8_t *cur = buf; int rc; + if (buf == NULL) { + osmo_cbsp_errstr = "cell list: missing mandatory IE"; + return -ENOENT; + } else if (len < 1) { + osmo_cbsp_errstr = "cell list: too short"; + return -EINVAL; + } + cl->id_discr = *cur++; while (cur < buf + len) { -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/44159?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I31c66fad36f380fb6706a935df412fd6114f4cd9 Gerrit-Change-Number: 44159 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-CC: pespin <pespin@sysmocom.de>
participants (1)
-
laforge