[PATCH] libosmo-sccp[master]: sccp_test: sanitize: don't memcmp NULL pointers

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Nov 17 02:34:19 UTC 2017


Review at  https://gerrit.osmocom.org/4881

sccp_test: sanitize: don't memcmp NULL pointers

Change-Id: I0159a875c1e11f4f9728d9e09f5c365b8174673a
---
M tests/sccp/sccp_test.c
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/81/4881/1

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 @@
 				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);
 			}
 		}

-- 
To view, visit https://gerrit.osmocom.org/4881
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0159a875c1e11f4f9728d9e09f5c365b8174673a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list