aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ussd/ussd_test.c
AgeCommit message (Collapse)AuthorFilesLines
2021-12-14treewide: remove FSF addressOliver Smith1-4/+0
Remove the paragraph about writing to the Free Software Foundation's mailing address. The FSF has changed addresses in the past, and may do so again. In 2021 this is not useful, let's rather have a bit less boilerplate at the start of source files. Change-Id: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2018-06-11gsm/gsm0480: refactor and expose gsm0480_parse_facility_ie()Vadim Yanitskiy1-0/+40
This function can be used when there is only a part of GSM 04.80 message available - Facility IE, e.g. when a message is carried over GSUP/MAP. Let's expose it. Refactoring includes the following: - adding the 'gsm0480_' prefix; - correcting inverted return value; - cosmetic code style changes. Change-Id: I623c39ffbe6cdee65eade8435a2faa04d0da193e
2018-06-11gsm/gsm0480.c: introduce gsm0480_extract_ie_by_tag()Vadim Yanitskiy1-0/+75
In some cases, there is no need to parse the whole message, e.g. during the conversion from DTAP to GSUP/MAP. This function can be used to extract given IE from a message. Change-Id: I3989d061903352473305f80712f1a1560d05df3d
2018-04-06use osmo_init_logging2() with proper talloc ctxNeels Hofmeyr1-1/+2
Ironically, when deprecating osmo_init_logging() in I216837780e9405fdaec8059c63d10699c695b360, I forgot to change the callers within libosmocore itself, i.e. in the various regression tests. Change-Id: Ia36c248f99353d5baaa2533f46a2f60a8579bdf8
2018-01-22tests/ussd: prevent uninitialized memory accessVadim Yanitskiy1-2/+1
Previously an incorrect length value was passed to both gsm_7bit_decode_n_ussd() and gsm_7bit_encode_n_ussd() functions during test_7bit_ussd() execution, due to: octets_written = strlen(decoded); The problem is that a 7-bit encoded string takes less memory than its 8-bit equivalent. So, here strlen() returns one-byte bigger value, that octets_written is. This then causes the uninitialized memory access. Found using Valgrind: Conditional jump or move depends on uninitialised value(s) at 0x506DCCC: gsm_7bit_decode_n_ussd (gsm_utils.c:248) by 0x40134B: test_7bit_ussd (ussd_test.c:104) by 0x400F5D: main (ussd_test.c:161) Conditional jump or move depends on uninitialised value(s) at 0x506DBB7: gsm_7bit_decode_n_hdr (gsm_utils.c:220) by 0x506DC9E: gsm_7bit_decode_n_ussd (gsm_utils.c:246) by 0x40134B: test_7bit_ussd (ussd_test.c:104) by 0x400F5D: main (ussd_test.c:161) Conditional jump or move depends on uninitialised value(s) at 0x506DBCB: gsm_septet_lookup (gsm_utils.c:153) by 0x506DBCB: gsm_7bit_decode_n_hdr (gsm_utils.c:224) by 0x506DC9E: gsm_7bit_decode_n_ussd (gsm_utils.c:246) by 0x40134B: test_7bit_ussd (ussd_test.c:104) by 0x400F5D: main (ussd_test.c:161) Change-Id: Ic31805b6a5a917dfc6284edba6ffdd21246ac20c
2018-01-17tests/ussd: fix wrong GSM 04.80 payload lengthVadim Yanitskiy1-3/+7
Previously the same length value was used for both ussd_request and interrogate_ss payloads, despite they are different. Change-Id: I90ae7c51b75dcdb9d8ee042af23d127e6db8771d
2018-01-13ussd_test.c: fix rc / len debug output confusionVadim Yanitskiy1-2/+2
Both len and rc values were swapped in the test output. Change-Id: Iebd82531c6ced5d16b15dad4ff4ce654c82db309
2016-07-12ussd: Decode interrogateSS that doesn't have testHolger Hans Peter Freyther1-0/+12
Keith of Rhizomatica has an issue of a unrejected interrogateSS. Start with just decoding the message and printing the empty test and the code. What is kind of missing is the classification between invoke, returnResult and returnResultLast that we need to add in the long run. Change-Id: Iadfa156707a96f2a34f3948c7cc9a74435f17114
2015-01-01Supplementary Services (de)activation, interrogation addedTobias Engel1-7/+7
These patches enhance the Supplementary Service (SS) processing from only being able to handle USSD to other SS, specifically activation, deactivation and interrogation of those SS. Registration is not yet implemented. include/osmocom/gsm/protocol/gsm_09_02.h has been added with needed values for SS. Modified by Harald Welte to keep the old ussd-only functiosn for API/ABI stability.
2013-08-12sms: Added result buffer size parameter to 7bit conv funsJacob Erlbeck1-7/+43
The 7bit<->8bit encoding/decoding functions didn't check whether there is still enough space in the destination buffer. Therefore a buffer size parameter has been added to each of the functions which is used to truncate the output if the buffer is too small. In addition, the return value of the decoding functions has been changed to number of characters written (excluding \0), so this value is always equal to strlen(decoded). The old functions are still available as wrapper functions.
2013-08-08ussd: Changed 7bit test to check spec conformance directlyJacob Erlbeck1-6/+13
Renamed gsm_7bit_ussd() to test_7bit_ussd() and extended the function to take the expected binary encoding and eventually added trailing bytes in the re-decoded text as arguments. These are used to check assertions of the right behaviour instead of solely relying on regression data, because the value are determined by the spec and fixed and it is more obvious this way. Especially concerning the case with the duplicated \r which can easily be overlooked when it's only present in the ok file.
2013-08-08Add special 7-bit encoding and decoding functions for USSD codingAndreas Eversberg1-0/+22
Handling 7-bit coding is a little different for USSD, as TS 03.38 states: To avoid the situation where the receiving entity confuses 7 binary zero pad bits as the @ character, the carriage return or <CR> character shall be used for padding in this situation [...]. If <CR> is intended to be the last character and the message (including the wanted <CR>) ends on an octet boundary, then another <CR> must be added together with a padding bit 0. The receiving entity will perform the carriage return function twice, but this will not result in misoperation as the definition of <CR> [...] is identical to the definition of <CR><CR>. The receiving entity shall remove the final <CR> character where the message ends on an octet boundary with <CR> as the last character. Jacob has verified the fix with fakeBTS and the wireshark dissector. Fixes: OW#947 Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
2011-11-14tests: Initialize log system to fix crash, update test resultHolger Hans Peter Freyther1-0/+6
Use osmo_init_logging to initialize the log system to fix crashes when we attempt to parse broken ASN1 messages. Ignore stderr with parse errors, update the test result. make check is now passing.
2011-03-23include: reorganize headers file to include/osmocom/[gsm|core]0.2.0Pablo Neira Ayuso1-1/+1
This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2010-10-11ussd: Verify that parsing is stil working and print the decoded text.Holger Hans Peter Freyther1-0/+5
2010-10-11ussd: Add next test that show that we access the data out of boundsHolger Hans Peter Freyther1-0/+23
This test is showing that the internal ASN1 code is not checking the size properly.
2010-10-11ussd: Add a test case, switch parsing to use a gsm48_hdr and lenHolger Hans Peter Freyther1-0/+63
The current USSD code is not doing any size checks, add a test case to find out how easily we access the data out of bounds. Begin to use the length in some places.