From: Shreenidhi Shedi <shreenidhi.sh...@broadcom.com>

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.sh...@broadcom.com>
Reviewed-by: Alexey Makhalov  <alexey.makha...@broadcom.com>
---
 grub-core/lib/envblk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/lib/envblk.c b/grub-core/lib/envblk.c
index 2e4e78b13..4862de50d 100644
--- a/grub-core/lib/envblk.c
+++ b/grub-core/lib/envblk.c
@@ -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;
-- 
2.49.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to