Browse Source

[PAL] Skip trailing whitespaces/comments in manifest files

Chia-Che Tsai 6 years ago
parent
commit
6583e69a04
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Pal/lib/graphene/config.c

+ 5 - 2
Pal/lib/graphene/config.c

@@ -339,8 +339,11 @@ int read_config (struct config_store * store,
             vlen = (ptr - shift) - val;
         } else {
             val = ptr;
-            for ( ; RANGE && !IS_SKIP(ptr) ; ptr++);
-            vlen = ptr - val;
+            char* last = ptr - 1;
+            for ( ; RANGE && !IS_SKIP(ptr) ; ptr++)
+                if (!IS_SPACE(*ptr)) // Skip the trailing whitespaces
+                    last = ptr;
+            vlen = last + 1 - val;
         }
         ptr++;