Fix crash on no parameter_key

Default parameter_key to a 0 length string, instead of NULL.

Otherwise, the code in cwmp_ubus_call and blobmsg_add_string
 will attempt a strlen on a NULL string, which segfaults.
This commit is contained in:
Simon Tate 2021-05-13 09:47:10 +00:00
parent e4b3f6d71f
commit 8f7af4bd2d

2
xml.c
View file

@ -1545,7 +1545,7 @@ int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc
goto fault;
transaction_started = true;
}
fault_code = cwmp_set_multiple_parameters_values(&list_set_param_value, parameter_key, &flag, rpc->list_set_value_fault);
fault_code = cwmp_set_multiple_parameters_values(&list_set_param_value, parameter_key ? parameter_key : "", &flag, rpc->list_set_value_fault);
if (fault_code != FAULT_CPE_NO_FAULT)
goto fault;