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
This commit is contained in:
parent
9d61db7f06
commit
7f97d67108
|
@ -793,7 +793,8 @@ static struct gsm_sms *sms_from_result(struct gsm_network *net, dbi_result resul
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue