aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-04-25 13:12:58 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-04-25 13:26:07 +0200
commitf6e56058f4fe8497d39b78f14ad61e00ecad4430 (patch)
treeffd29c8f65010faccdd4c035c5df716c4f3cb35d
parent3d12748f5bbb4c2de66260933494715c224f1d7a (diff)
ranap_parse_lai(): properly initialize out-arg, adjust test experr
The test stderr output changes merely because the source code line numbers of the error logging changed. Fixes: CID#93770
-rw-r--r--src/ranap_common.c4
-rw-r--r--src/tests/test-helpers.err4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/ranap_common.c b/src/ranap_common.c
index dc46459..a468229 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 9c04723..81b79e1 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