]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Support escaped quotes (\") in ventoy.json. (#1062)
authorlongpanda <admin@ventoy.net>
Tue, 17 Aug 2021 01:25:00 +0000 (09:25 +0800)
committerlongpanda <admin@ventoy.net>
Tue, 17 Aug 2021 01:25:00 +0000 (09:25 +0800)
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_json.c

index b9e4a743490d78548fa4fd509f2c81245cebea6d..8f81779fff16e18bdeb2fa658152b6f696150068 100644 (file)
@@ -152,6 +152,23 @@ static int vtoy_json_parse_string
         return JSON_FAILED;
     }
 
         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);    
     
     *ppcEnd = pcPos + 1;
     uiLen = (grub_uint32_t)(unsigned long)(pcPos - pcTmp);