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