grub2/0096-Don-t-use-dynamic-sized-arrays-since-we-don-t-build-.patch
Peter Jones 77d0810cf0 Fix tftp filename mangling and secure boot dmesg error.
Fix tftp filename mangling to not reuse the wrong variable
  Resolves: rhbz#1405208
Make grub2 initialize the kernel's boot_params structure correctly so the
  upstream SB code doesn't throw a fit.
  Resolves: rhbz#1418360
  Resolves: rhbz#1451071

Signed-off-by: Peter Jones <pjones@redhat.com>
2017-06-26 17:02:20 -04:00

46 lines
1.4 KiB
Diff

From e26bdce564d529852f8f3d27874dc15467839033 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 26 Jun 2017 12:42:57 -0400
Subject: [PATCH 096/105] Don't use dynamic sized arrays since we don't build
with -std=c99
---
grub-core/net/net.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 16d2ce06d..b4325750f 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -1781,14 +1781,25 @@ grub_net_search_configfile (char *config)
{
/* By the Client UUID. */
- char client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) +
- sizeof ("_clientuuid") + 1];
- grub_snprintf (client_uuid_var, sizeof (client_uuid_var),
+ 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 = grub_malloc(client_uuid_var_size);
+ if (!client_uuid_var)
+ continue;
+ grub_snprintf (client_uuid_var, client_uuid_var_size,
"net_%s_clientuuid", inf->name);
const char *client_uuid;
client_uuid = grub_env_get (client_uuid_var);
+ grub_free(client_uuid_var);
+
if (client_uuid)
{
grub_strcpy (suffix, client_uuid);
--
2.13.0