Fix heap overflow when reading corrupt config with "log_dest file".
This commit is contained in:
parent
284db04bc3
commit
70d713ca07
@ -31,6 +31,7 @@ Broker:
|
|||||||
not a string, when loading the dynsec config from file only.
|
not a string, when loading the dynsec config from file only.
|
||||||
- Dynsec plugin will not allow duplicate clients/groups/roles when loading
|
- Dynsec plugin will not allow duplicate clients/groups/roles when loading
|
||||||
config from file, which matches the behaviour for when creating them.
|
config from file, which matches the behaviour for when creating them.
|
||||||
|
- Fix heap overflow when reading corrupt config with "log_dest file".
|
||||||
|
|
||||||
Client library:
|
Client library:
|
||||||
- Use CLOCK_BOOTTIME when available, to keep track of time. This solves the
|
- Use CLOCK_BOOTTIME when available, to keep track of time. This solves the
|
||||||
|
@ -1533,16 +1533,17 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
|
|||||||
}else if(!strcmp(token, "dlt")){
|
}else if(!strcmp(token, "dlt")){
|
||||||
cr->log_dest |= MQTT3_LOG_DLT;
|
cr->log_dest |= MQTT3_LOG_DLT;
|
||||||
}else if(!strcmp(token, "file")){
|
}else if(!strcmp(token, "file")){
|
||||||
cr->log_dest |= MQTT3_LOG_FILE;
|
|
||||||
if(config->log_fptr || config->log_file){
|
if(config->log_fptr || config->log_file){
|
||||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Duplicate \"log_dest file\" value.");
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Duplicate \"log_dest file\" value.");
|
||||||
return MOSQ_ERR_INVAL;
|
return MOSQ_ERR_INVAL;
|
||||||
}
|
}
|
||||||
/* Get remaining string. */
|
/* Get remaining string. */
|
||||||
token = &token[strlen(token)+1];
|
token = saveptr;
|
||||||
|
if(token && token[0]){
|
||||||
while(token[0] == ' ' || token[0] == '\t'){
|
while(token[0] == ' ' || token[0] == '\t'){
|
||||||
token++;
|
token++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(token[0]){
|
if(token[0]){
|
||||||
config->log_file = mosquitto__strdup(token);
|
config->log_file = mosquitto__strdup(token);
|
||||||
if(!config->log_file){
|
if(!config->log_file){
|
||||||
@ -1553,6 +1554,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
|
|||||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty \"log_dest file\" value in configuration.");
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty \"log_dest file\" value in configuration.");
|
||||||
return MOSQ_ERR_INVAL;
|
return MOSQ_ERR_INVAL;
|
||||||
}
|
}
|
||||||
|
cr->log_dest |= MQTT3_LOG_FILE;
|
||||||
}else{
|
}else{
|
||||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid log_dest value (%s).", token);
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid log_dest value (%s).", token);
|
||||||
return MOSQ_ERR_INVAL;
|
return MOSQ_ERR_INVAL;
|
||||||
|
@ -951,6 +951,7 @@ int handle__connect(struct mosquitto *context)
|
|||||||
|
|
||||||
|
|
||||||
handle_connect_error:
|
handle_connect_error:
|
||||||
|
mosquitto_property_free_all(&properties);
|
||||||
mosquitto__free(auth_data);
|
mosquitto__free(auth_data);
|
||||||
mosquitto__free(client_id);
|
mosquitto__free(client_id);
|
||||||
mosquitto__free(username);
|
mosquitto__free(username);
|
||||||
|
Loading…
Reference in New Issue
Block a user