aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-11-17 02:55:35 +0100
committerHarald Welte <laforge@gnumonks.org>2017-11-18 10:19:04 +0000
commita17ecfa7b174f0104ff124666706662dd88394b5 (patch)
tree10b4aa7ed3eac5ad7634a5ef7469c989bc323458
parent3867a7422a5e52a31b3268c9034984c64b2f997b (diff)
sccp_test: sanitize: don't memcmp NULL pointers
-rw-r--r--tests/sccp/sccp_test.c10
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);
}
}