dynsec: setClientId should cope with missing/empty client id.

pull/1907/head
Roger A. Light 5 years ago
parent eac0c3bac0
commit 63277aad0b

@ -575,10 +575,14 @@ int dynsec_clients__process_set_id(cJSON *j_responses, struct mosquitto *context
return MOSQ_ERR_SUCCESS;
}
clientid_heap = mosquitto_strdup(clientid);
if(clientid_heap == NULL){
dynsec__command_reply(j_responses, context, "setClientId", "Internal error", correlation_data);
return MOSQ_ERR_NOMEM;
if(clientid != NULL && strlen(clientid) > 0){
clientid_heap = mosquitto_strdup(clientid);
if(clientid_heap == NULL){
dynsec__command_reply(j_responses, context, "setClientId", "Internal error", correlation_data);
return MOSQ_ERR_NOMEM;
}
}else{
clientid_heap = NULL;
}
mosquitto_free(client->clientid);

Loading…
Cancel
Save