2020-07-21 10:23:41 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
|
|
|
|
Date: Tue, 18 Dec 2018 21:27:45 -0500
|
|
|
|
Subject: [PATCH] Fix the looking up grub.cfg-XXX while tftp booting.
|
|
|
|
|
|
|
|
Currently, grub doesn't look up grub.cfg-UUID, grub.cfg-MAC and grub.cfg-IP
|
|
|
|
while the boot is from tftp. That is because the uuid size is got by
|
|
|
|
grub_snprintf(, 0, ,), but the grub_snprintf() always returns 0,
|
|
|
|
so grub judges there's no available uuid in the client and give up
|
|
|
|
the looking up grub.cfg-XXX.
|
|
|
|
|
|
|
|
This issue can be fixed by changing grub_snprintf(, 0, ,) behaivior
|
|
|
|
to like as snprintf() from glibc, however, somewhere may expect
|
|
|
|
such argument as the error, so it's risky.
|
|
|
|
|
|
|
|
Let's use sizeof() and grub_strlen() to calculate the uuid size
|
|
|
|
instead of grub_snprintf().
|
|
|
|
|
|
|
|
Resolves: rhbz#1658500
|
|
|
|
---
|
|
|
|
grub-core/net/net.c | 8 +++-----
|
|
|
|
1 file changed, 3 insertions(+), 5 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
2022-05-10 07:20:45 +00:00
|
|
|
index a011b9401..19ff2d486 100644
|
2020-07-21 10:23:41 +00:00
|
|
|
--- a/grub-core/net/net.c
|
|
|
|
+++ b/grub-core/net/net.c
|
|
|
|
@@ -1942,11 +1942,9 @@ grub_net_search_configfile (char *config)
|
|
|
|
char *client_uuid_var;
|
|
|
|
grub_size_t client_uuid_var_size;
|
|
|
|
|
|
|
|
- client_uuid_var_size = grub_snprintf (NULL, 0,
|
|
|
|
- "net_%s_clientuuid", inf->name);
|
|
|
|
- if (client_uuid_var_size <= 0)
|
|
|
|
- continue;
|
|
|
|
- client_uuid_var_size += 1;
|
|
|
|
+ client_uuid_var_size = sizeof ("net_") + grub_strlen (inf->name) +
|
|
|
|
+ sizeof ("_clientuuid") + 1;
|
|
|
|
+
|
|
|
|
client_uuid_var = grub_malloc(client_uuid_var_size);
|
|
|
|
if (!client_uuid_var)
|
|
|
|
continue;
|