diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2018-01-17 15:03:32 +0600 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-01-17 10:45:40 +0000 |
commit | ac3b6ac3011d0544f6f04c320ba78df93659f72c (patch) | |
tree | 5fd30f2172a717780aea706fc52ecd53255d2e26 /tests/ussd | |
parent | b41c70f4e600b7d7d5de5805c9b9c7b2b6c70d36 (diff) |
tests/ussd: fix wrong GSM 04.80 payload length
Previously the same length value was used for both ussd_request
and interrogate_ss payloads, despite they are different.
Change-Id: I90ae7c51b75dcdb9d8ee042af23d127e6db8771d
Diffstat (limited to 'tests/ussd')
-rw-r--r-- | tests/ussd/ussd_test.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/ussd/ussd_test.c b/tests/ussd/ussd_test.c index bf6d731c..8d88dbb1 100644 --- a/tests/ussd/ussd_test.c +++ b/tests/ussd/ussd_test.c @@ -120,24 +120,28 @@ static void test_7bit_ussd(const char *text, const char *encoded_hex, const char int main(int argc, char **argv) { struct ss_request req; - const int size = sizeof(ussd_request); + uint16_t size; int i; struct msgb *msg; osmo_init_logging(&info); memset(&req, 0, sizeof(req)); - gsm0480_decode_ss_request((struct gsm48_hdr *) ussd_request, size, &req); + gsm0480_decode_ss_request((struct gsm48_hdr *) ussd_request, + sizeof(ussd_request), &req); printf("Tested if it still works. Text was: %s\n", req.ussd_text); memset(&req, 0, sizeof(req)); - gsm0480_decode_ss_request((struct gsm48_hdr *) interrogate_ss, size, &req); + gsm0480_decode_ss_request((struct gsm48_hdr *) interrogate_ss, + sizeof(interrogate_ss), &req); OSMO_ASSERT(strlen((char *) req.ussd_text) == 0); OSMO_ASSERT(req.ss_code == 33); printf("interrogateSS CFU text..'%s' code %d\n", req.ussd_text, req.ss_code); printf("Testing parsing a USSD request and truncated versions\n"); + size = sizeof(ussd_request); + for (i = size; i > sizeof(struct gsm48_hdr); --i) { int rc = parse_ussd(&ussd_request[0], i); printf("Result for len=%d is %d\n", i, rc); |