]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
lib/envblk: Ignore empty new lines while parsing env files
authorShreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Mon, 19 May 2025 18:19:54 +0000 (23:49 +0530)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 29 May 2025 13:45:09 +0000 (15:45 +0200)
Environment files may contain empty lines, which should be ignored
during parsing. Currently, these lines are not skipped and resulting in
incorrect behavior. This patch adds a check to skip empty lines along
with those starting with "#".

Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Reviewed-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/lib/envblk.c

index 2e4e78b132d4946b33f94950c16549657a5e46db..4862de50d367f5630bb8ce594e0bfe142aabf444 100644 (file)
@@ -235,7 +235,7 @@ grub_envblk_iterate (grub_envblk_t envblk,
 
   while (p < pend)
     {
-      if (*p != '#')
+      if (*p != '#' && *p != '\n' && *p != '\r')
         {
           char *name;
           char *value;