From: Shreenidhi Shedi Date: Mon, 19 May 2025 18:19:54 +0000 (+0530) Subject: lib/envblk: Ignore empty new lines while parsing env files X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be303f8c1859b17e0dbee88cb7c8490058c150f4;p=thirdparty%2Fgrub.git lib/envblk: Ignore empty new lines while parsing env files 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 Reviewed-by: Alexey Makhalov Reviewed-by: Daniel Kiper --- 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;