From 90bc76956c1a6cd29a9120a4bafa3bbdfe39f428 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Mon, 5 Dec 2022 19:25:40 +0000 Subject: Ignore trailing whitespace in settings .cfg files Have settings_parseline() strip trailing whitespace from the setting value. Fixes a regression introduced by 5b1dd64f5, which caused filename settings to be parsed incorrectly when there is trailing whitespace in the .cfg file. Change-Id: I6c54428f6467ea2d169d2a7449705b40627e1a40 --- apps/misc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/misc.c b/apps/misc.c index 327dc5802d..63a3a2a6eb 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -272,6 +272,15 @@ bool settings_parseline(char* line, char** name, char** value) ptr++; ptr = skip_whitespace(ptr); *value = ptr; + + /* strip whitespace from the right side of value */ + ptr += strlen(ptr); + for (ptr--; ptr >= *value; ptr--) + { + if (isspace(*ptr)) + *ptr = '\0'; + } + return true; } -- cgit