diff mbox series

downloader: fix parsing of configuration file

Message ID 1519581723-24089-1-git-send-email-sbabic@denx.de
State Accepted
Headers show
Series downloader: fix parsing of configuration file | expand

Commit Message

Stefano Babic Feb. 25, 2018, 6:02 p.m. UTC
GET_FIELD_STRING_RESET() ensure that the returned string is empty
after parsing an entry, else the string contains last parsed element.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 corelib/downloader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/corelib/downloader.c b/corelib/downloader.c
index 40a5553..108a6f6 100644
--- a/corelib/downloader.c
+++ b/corelib/downloader.c
@@ -305,12 +305,12 @@  static int download_settings(void *elem, void  __attribute__ ((__unused__)) *dat
 	struct dwl_options *opt = (struct dwl_options *)data;
 	char tmp[128];
 
-	GET_FIELD_STRING(LIBCFG_PARSER, elem, "url", tmp);
+	GET_FIELD_STRING_RESET(LIBCFG_PARSER, elem, "url", tmp);
 	if (strlen(tmp)) {
 		SETSTRING(opt->url, tmp);
 	}
 
-	GET_FIELD_STRING(LIBCFG_PARSER, elem, "authentication", tmp);
+	GET_FIELD_STRING_RESET(LIBCFG_PARSER, elem, "authentication", tmp);
 	if (strlen(tmp)) {
 		SETSTRING(opt->auth, tmp);
 	} else {