pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/14355
Change subject: db: Fix call to mempcy with NULL src ptr ...................................................................... db: Fix call to mempcy with NULL src ptr Catched by ASan on db_sms_test unit test: DDB NOTICE test_db_sms_get('Empty TP-UD'): osmo-msc/src/libmsc/db.c:796:2: runtime error: null pointer passed as argument 2, which is declared to never be null That happens on empty PDU because dbi_result_get_binary returns NULL, and sms->user_data_len is 0, so it's harmless but we can avoid calling mempcy and make ASan happy. Change-Id: I545967464c406348b8505d1729213cfb4afcd3e2 --- M src/libmsc/db.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/55/14355/1 diff --git a/src/libmsc/db.c b/src/libmsc/db.c index add6304..e3995a6 100644 --- a/src/libmsc/db.c +++ b/src/libmsc/db.c @@ -793,7 +793,8 @@ user_data = dbi_result_get_binary(result, "user_data"); if (sms->user_data_len > sizeof(sms->user_data)) sms->user_data_len = (uint8_t) sizeof(sms->user_data); - memcpy(sms->user_data, user_data, sms->user_data_len); + if (user_data) + memcpy(sms->user_data, user_data, sms->user_data_len); text = dbi_result_get_string(result, "text"); if (text) -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14355 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I545967464c406348b8505d1729213cfb4afcd3e2 Gerrit-Change-Number: 14355 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-MessageType: newchange