Fix parsing of configuration options that end with a space.

Closes #804.

Thanks to Nicola Lunghi.
pull/793/merge
Roger A. Light 8 years ago
parent 6c7ecd7e97
commit 377dc82d3f

@ -82,6 +82,7 @@ Broker fixes:
- Maximum connections on Windows increased to 2048.
- When a client with an in-use client-id connects, if the old client has a
will, send the will message. Closes #26.
- Fix parsing of configuration options that end with a space. Closes #804.
Client library features:
- Outgoing messages with QoS>1 are no longer retried after a timeout period.

@ -2040,6 +2040,7 @@ static int conf__parse_int(char **token, const char *name, int *value, char *sav
static int conf__parse_string(char **token, const char *name, char **value, char *saveptr)
{
int len;
*token = strtok_r(NULL, "", &saveptr);
if(*token){
if(*value){
@ -2050,7 +2051,12 @@ 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))){
len = strlen(*token);
while((*token)[len-1] == ' '){
(*token)[len-1] = '\0';
len--;
}
if(mosquitto_validate_utf8(*token, len)){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Malformed UTF-8 in configuration.");
return MOSQ_ERR_INVAL;
}

Loading…
Cancel
Save