Fix heap overflow when reading config.

This catches an error case where the broker would be exiting anyway.

Closes oss-fuzz #56008
pull/2768/head
Roger A. Light 3 years ago
parent 84e21d478c
commit fa92db5480

@ -1073,11 +1073,11 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
mosquitto__FREE(key);
return MOSQ_ERR_INVAL;
}
token += prefix_len+strlen(key)+1;
while(token[0] == ' ' || token[0] == '\t'){
token++;
}
if(token[0]){
token = saveptr;
if(token && token[0]){
while(token[0] == ' ' || token[0] == '\t'){
token++;
}
cur_plugin->config.option_count++;
cur_plugin->config.options = mosquitto__realloc(cur_plugin->config.options, (size_t)cur_plugin->config.option_count*sizeof(struct mosquitto_auth_opt));
if(!cur_plugin->config.options){

Loading…
Cancel
Save