diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-17 02:55:35 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-11-18 10:19:04 +0000 |
commit | a17ecfa7b174f0104ff124666706662dd88394b5 (patch) | |
tree | 10b4aa7ed3eac5ad7634a5ef7469c989bc323458 | |
parent | 3867a7422a5e52a31b3268c9034984c64b2f997b (diff) |
sccp_test: sanitize: don't memcmp NULL pointers
Change-Id: I0159a875c1e11f4f9728d9e09f5c365b8174673a
-rw-r--r-- | tests/sccp/sccp_test.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/sccp/sccp_test.c b/tests/sccp/sccp_test.c index d6abc5d..ed485bc 100644 --- a/tests/sccp/sccp_test.c +++ b/tests/sccp/sccp_test.c @@ -886,15 +886,17 @@ static void test_sccp_parsing(void) FAIL("GTI length is wrong: %d\n", result.called.gti_len); } - if (memcmp(&parse_result[current_test].dst_gti_data[0], - result.called.gti_data, result.called.gti_len) != 0) { + if (parse_result[current_test].dst_gti_data + && memcmp(&parse_result[current_test].dst_gti_data[0], + result.called.gti_data, result.called.gti_len) != 0) { FAIL("GTI data is wrong: %d '%s'\n", result.called.gti_len, osmo_hexdump(result.called.gti_data, result.called.gti_len)); } - if (memcmp(&parse_result[current_test].src_gti_data[0], - result.calling.gti_data, result.calling.gti_len) != 0) { + if (parse_result[current_test].src_gti_data + && memcmp(&parse_result[current_test].src_gti_data[0], + result.calling.gti_data, result.calling.gti_len) != 0) { FAIL("GTI data is wrong: %d\n", result.calling.gti_len); } } |