From 84ec4b0de495c3225cb05499acb0d95dd87b5b35 Mon Sep 17 00:00:00 2001 From: longpanda Date: Tue, 17 Aug 2021 09:25:00 +0800 Subject: [PATCH] Support escaped quotes (\") in ventoy.json. (#1062) --- .../grub-2.04/grub-core/ventoy/ventoy_json.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_json.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_json.c index b9e4a743..8f81779f 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_json.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_json.c @@ -152,6 +152,23 @@ static int vtoy_json_parse_string return JSON_FAILED; } + if (*(pcPos - 1) == '\\') + { + for (pcPos++; *pcPos; pcPos++) + { + if (*pcPos == '"' && *(pcPos - 1) != '\\') + { + break; + } + } + + if (*pcPos == 0 || pcPos < pcTmp) + { + json_debug("Invalid quotes string %s.", pcData); + return JSON_FAILED; + } + } + *ppcEnd = pcPos + 1; uiLen = (grub_uint32_t)(unsigned long)(pcPos - pcTmp);