aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/gbproxy
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-04 14:22:13 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-08-04 15:00:54 +0200
commitce1b22e817584d512f82a711c02b67d12346c202 (patch)
tree5318c4557958272364f66e954359b6bbb7a36edb /openbsc/tests/gbproxy
parent4d9fc422d2dd17118d70a2ed25ab383614a81ede (diff)
gprs: Add testcases for the APN string/octet conversion and fix it
Create a testcase for the gprs_str_to_apn and gprs_apn_to_str routines. While writing the testcase we noticed it is possible to write more bytes than should have been allowed. This is fixed by checking that the max_len is at least 1 (needed to write the first length octet) and to do the size check before writing to the output. Modify the signature of gprs_str_to_apn to put the length/size next to the parameter that requires a size. Done with Jacob
Diffstat (limited to 'openbsc/tests/gbproxy')
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index 0d14d2194..aa909ef42 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -945,7 +945,7 @@ static void test_gbproxy_ra_patching()
gbcfg.core_mcc = 123;
gbcfg.core_mnc = 456;
gbcfg.core_apn = talloc_zero_size(NULL, 100);
- gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, "foo.bar", 100);
+ gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar");
configure_sgsn_peer(&sgsn_peer);
configure_bss_peers(bss_peer, ARRAY_SIZE(bss_peer));