From c6450ac2653c16e0e26b604d1c250fd006ac4eef Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 15 Mar 2015 20:49:18 +0000 Subject: [PATCH] [462154] Fix problems parsing config strings with leading spaces. Thanks to Aidan Gill. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=462154 --- ChangeLog.txt | 2 ++ src/conf.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 1cb58adb..f5e4a1f7 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,7 @@ Broker: - Fix possible crash when using pattern ACLs. +- Fix problems parsing config strings with multiple leading spaces. Closes + #462154. Client library: - Inflight limits should only apply to outgoing messages. Closes #461620. diff --git a/src/conf.c b/src/conf.c index bd42c334..292a10fe 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1967,6 +1967,10 @@ static int _conf_parse_string(char **token, const char *name, char **value, char _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Duplicate %s value in configuration.", name); return MOSQ_ERR_INVAL; } + /* Deal with multiple spaces at the beginning of the string. */ + while((*token)[0] == ' '){ + (*token)++; + } *value = _mosquitto_strdup(*token); if(!*value){ _mosquitto_log_printf(NULL, MOSQ_LOG_ERR, "Error: Out of memory.");