libubox/tests/cram
Petr Štetiar 478597b9f9 blob: fix OOB access in blob_check_type
Found by fuzzer:

 ERROR: AddressSanitizer: SEGV on unknown address 0x602100000455
 The signal is caused by a READ memory access.
     #0 in blob_check_type blob.c:214:43
     #1 in blob_parse_attr blob.c:234:9
     #2 in blob_parse_untrusted blob.c:272:12
     #3 in fuzz_blob_parse tests/fuzzer/test-blob-parse-fuzzer.c:34:2
     #4 in LLVMFuzzerTestOneInput tests/fuzzer/test-blob-parse-fuzzer.c:39:2

Caused by following line:

	if (type == BLOB_ATTR_STRING && data[len - 1] != 0)

where len was pointing outside of the data buffer.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-25 10:31:58 +01:00
..
inputs tests: add test cases for blob parsing 2019-12-25 10:31:58 +01:00
CMakeLists.txt add cram based unit tests 2019-11-24 13:26:58 +01:00
test_avl.t tests: add unit tests covered with Clang sanitizers 2019-12-25 10:31:58 +01:00
test_base64.t tests: add unit tests covered with Clang sanitizers 2019-12-25 10:31:58 +01:00
test_blob_parse.t blob: fix OOB access in blob_check_type 2019-12-25 10:31:58 +01:00
test_blobmsg.t tests: add unit tests covered with Clang sanitizers 2019-12-25 10:31:58 +01:00
test_jshn.t tests: add unit tests covered with Clang sanitizers 2019-12-25 10:31:58 +01:00
test_json_script.t tests: add unit tests covered with Clang sanitizers 2019-12-25 10:31:58 +01:00
test_list.t tests: add unit tests covered with Clang sanitizers 2019-12-25 10:31:58 +01:00
test_runqueue.t tests: add unit tests covered with Clang sanitizers 2019-12-25 10:31:58 +01:00