aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tlv/tlv_test.ok
AgeCommit message (Collapse)AuthorFilesLines
2021-01-12tlv_parser: Fix various out-of-bounds accessesHarald Welte1-0/+7
The libosmocore TLV parser had a number of insufficient bounds checks leading to reads beyond the end of the respective input buffer. This patch * adds proper out-of-bounds checks to all TLV types * simplifies some of the existing checks * introduces test cases to test all the corner cases where either TAG, or length, or value are not fully contained in the input buffer. Thanks to Ilja Van Sprundel for reporting these problems. Change-Id: I98b02c914c9e3ecf56050af846292aa6979d7508
2019-05-19TLV: Add one-shot TLV encoderHarald Welte1-0/+2
So far, the TLV code contained two types of functions * tlp_parse() to parse all TLVs according to definition into tlvp_parsed * various helper functions to encode individual TLVs during message generation This patch implements the inverse of tlv_parse(): tlv_encode(), which takes a full 'struct tlv_pared' and encodes all IEs found in it. The order of IEs is in numerically ascending order of the tag. As many protocols have different IE/TLV ordering requirements, let's add a tlv_encode_ordered() function where the caller can specify the TLV ordering during the one-shot encode. Change-Id: I761a30bf20355a9f80a4a8e0c60b0b0f78515efe
2016-05-05tlv: Import osmo_shift_* and osmo_match_shift_* from openbscHarald Welte1-0/+2
These routines have nothing to do with specifically the BSC, so import them to the TLV parser we keep in libosmogsm.