fixeria has uploaded this change for review.
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(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/44159/1
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 change 44159. To unsubscribe, or for help writing mail filters, visit settings.