From 443271de3591c1c455300486225fd439d467f993 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 6 Sep 2021 00:31:56 -0700 Subject: [PATCH] fusee: accept spaces inside ini values (we still left/right strip) --- fusee/program/source/fusee_ini.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fusee/program/source/fusee_ini.cpp b/fusee/program/source/fusee_ini.cpp index 687ab4633..0d78b48eb 100644 --- a/fusee/program/source/fusee_ini.cpp +++ b/fusee/program/source/fusee_ini.cpp @@ -69,7 +69,7 @@ namespace ams::nxboot { TrailingSpace, }; - char *sec_start, *key_start, *val_start; + char *sec_start, *key_start, *val_start, *val_end; IniSection *cur_sec = nullptr; State state = State::Newline; @@ -144,13 +144,15 @@ namespace ams::nxboot { state = State::Newline; } else if (!IsWhiteSpace(c)) { val_start = buffer + i; + val_end = buffer + i + 1; state = State::Value; } break; case State::Value: - if (IsWhiteSpace(c) || c == '\n') { + if (c == '\r' || c == '\n') { buffer[i] = '\x00'; + *val_end = '\x00'; auto *entry = AllocateObject(); entry->key = key_start; @@ -159,6 +161,8 @@ namespace ams::nxboot { cur_sec->kv_list.push_back(*entry); state = (c == '\n') ? State::Newline : State::TrailingSpace; + } else if (c != ' ') { + val_end = buffer + i + 1; } break; case State::TrailingSpace: