mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-21 23:47:52 +08:00
dynsec: setClientId should cope with missing/empty client id.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user