diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-05 04:19:21 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-05 04:27:40 +0100 |
commit | 20f7d0ecb4d04bd20b132fadad50b3f914ed9fe0 (patch) | |
tree | feaec8cfc30bd514de3aed142289123eddfec294 /tests/gsm23003/gsm23003_test.c | |
parent | 680acae725b2b8dda2f239ff20073306fdfb3f6e (diff) |
fix osmo_mnc_from_str(): don't try to parse NULL
In osmo_mnc_from_str() do not try to return some values even if the validation
fails; hence don't try to decode a NULL pointer. That whole idea was half-baked
and a can of worms to begin with.
Change-Id: Ibaaa128ac60b941a015a31134eb52aef56bc6e22
Diffstat (limited to 'tests/gsm23003/gsm23003_test.c')
-rw-r--r-- | tests/gsm23003/gsm23003_test.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/gsm23003/gsm23003_test.c b/tests/gsm23003/gsm23003_test.c index ea08d0d9..947aa18d 100644 --- a/tests/gsm23003/gsm23003_test.c +++ b/tests/gsm23003/gsm23003_test.c @@ -136,14 +136,14 @@ static struct test_mnc_from_str test_mnc_from_strs[] = { { "001", { 0, 1, true } }, { "", { -EINVAL, 0, false } }, { " ", { -EINVAL, 0, false } }, - { "-1", { -EINVAL, 65535, false } }, - { "1000", { -EINVAL, 1000, true } }, + { "-1", { -EINVAL, 0, false } }, + { "1000", { -EINVAL, 0, false } }, { "0x", { -EINVAL, 0, false } }, - { " 23", { -EINVAL, 23, true } }, /* technically not a 3-digit MNC, but it's EINVAL anyway */ - { "23 ", { -EINVAL, 23, true } }, - { " 023", { -EINVAL, 23, true } }, - { "023 ", { -EINVAL, 23, true } }, - { "023 ", { -EINVAL, 23, true } }, + { " 23", { -EINVAL, 0, false } }, + { "23 ", { -EINVAL, 0, false } }, + { " 023", { -EINVAL, 0, false } }, + { "023 ", { -EINVAL, 0, false } }, + { "023 ", { -EINVAL, 0, false } }, }; static bool test_mnc_from_str() @@ -154,7 +154,7 @@ static bool test_mnc_from_str() for (i = 0; i < ARRAY_SIZE(test_mnc_from_strs); i++) { struct test_mnc_from_str *t = &test_mnc_from_strs[i]; - struct test_mnc_from_str_result result; + struct test_mnc_from_str_result result = {}; bool ok; result.rc = osmo_mnc_from_str(t->mnc_str, &result.mnc, |