Browse Source

[Pal] Delete '\' removal in read_config

If a backslash ('\') was encountered in a quoted ('"') value in a manifest,
it was getting deleted, but since the manifest is mapped read-only it caused
a segfault.
Removed this faulty behavior, now values are passed exactly as seen in
a manifest file, e.g. `loader.env.XXX = "\xY"Z"` passes an environmental
variable `XXX` with a value `"\xY"Z"`
borysp 5 years ago
parent
commit
75fb108d67
1 changed files with 4 additions and 10 deletions
  1. 4 10
      Pal/lib/graphene/config.c

+ 4 - 10
Pal/lib/graphene/config.c

@@ -333,18 +333,12 @@ int read_config(struct config_store* store, int (*filter)(const char* key, int k
         char* val = NULL;
         int vlen;
         if (*ptr == '"') {
-            int shift = 0;
-            val       = (++ptr);
-            for (; RANGE && *ptr != '"'; ptr++) {
-                if (*ptr == '\\') {
-                    shift++;
-                    ptr++;
-                }
-                if (shift)
-                    *(ptr - shift) = *ptr;
+            val = ++ptr;
+            while (RANGE && *ptr != '"') {
+                ptr++;
             }
             CHECK_PTR("stream ended without closing quote");
-            vlen = (ptr - shift) - val;
+            vlen = ptr - val;
         } else {
             val        = ptr;
             char* last = ptr - 1;