diff --git a/src/ranap_common.c b/src/ranap_common.c index dc464591..a468229f 100644 --- a/src/ranap_common.c +++ b/src/ranap_common.c @@ -498,6 +498,10 @@ int ranap_parse_lai(struct gprs_ra_id *ra_id, const RANAP_LAI_t *lai) { uint8_t *ptr = lai->pLMNidentity.buf; + /* Avoid unitialized mem for parse failures, and set rac to zero (which + * isn't being parsed). */ + *ra_id = (struct gprs_ra_id){ .lac = 0xfffe }; + /* TS 25.413 9.2.3.55 */ if (lai->pLMNidentity.size != 3) { LOGP(DRANAP, LOGL_ERROR, "Invalid PLMN Identity size:" diff --git a/src/tests/test-helpers.err b/src/tests/test-helpers.err index 9c04723d..81b79e19 100644 --- a/src/tests/test-helpers.err +++ b/src/tests/test-helpers.err @@ -1,3 +1,3 @@ -<0004> ranap_common.c:504 Invalid PLMN Identity size: should be 3, is 2 -<0004> ranap_common.c:518 Invalid LAC size: should be 2, is 1 +<0004> ranap_common.c:508 Invalid PLMN Identity size: should be 3, is 2 +<0004> ranap_common.c:522 Invalid LAC size: should be 2, is 1  \ No newline at end of file