Validate config strings as UTF-8.

This commit is contained in:
Roger A. Light 2018-04-13 14:53:10 +01:00
parent 8cb3a29fd7
commit 7bf16919f3

View File

@ -2026,6 +2026,10 @@ static int conf__parse_string(char **token, const char *name, char **value, char
while((*token)[0] == ' ' || (*token)[0] == '\t'){
(*token)++;
}
if(mosquitto_validate_utf8(*token, strlen(*token))){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Malformed UTF-8 in configuration.");
return MOSQ_ERR_INVAL;
}
*value = mosquitto__strdup(*token);
if(!*value){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");