Blame SOURCES/0308-efi-http-fix-some-allocation-error-checking.patch

c294fc
From 4436316229bc5b46016d61215b709ec434f4e0d3 Mon Sep 17 00:00:00 2001
c294fc
From: Peter Jones <pjones@redhat.com>
c294fc
Date: Sun, 19 Jul 2020 17:14:15 -0400
c294fc
Subject: [PATCH 308/314] efi+http: fix some allocation error checking.
c294fc
c294fc
Signed-off-by: Peter Jones <pjones@redhat.com>
c294fc
---
c294fc
 grub-core/net/efi/http.c | 11 +++++++----
c294fc
 1 file changed, 7 insertions(+), 4 deletions(-)
c294fc
c294fc
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
c294fc
index fc8cb25ae0a..26647a50fa4 100644
c294fc
--- a/grub-core/net/efi/http.c
c294fc
+++ b/grub-core/net/efi/http.c
c294fc
@@ -412,8 +412,8 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
c294fc
 		  int type)
c294fc
 {
c294fc
   grub_err_t err;
c294fc
-  grub_off_t size;
c294fc
-  char *buf;
c294fc
+  grub_off_t size = 0;
c294fc
+  char *buf = NULL;
c294fc
   char *file_name = NULL;
c294fc
   const char *http_path;
c294fc
 
c294fc
@@ -441,8 +441,11 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
c294fc
       return err;
c294fc
     }
c294fc
 
c294fc
-  buf = grub_malloc (size);
c294fc
-  efihttp_read (dev, buf, size);
c294fc
+  if (size)
c294fc
+    {
c294fc
+      buf = grub_malloc (size);
c294fc
+      efihttp_read (dev, buf, size);
c294fc
+    }
c294fc
 
c294fc
   file->size = size;
c294fc
   file->data = buf;
c294fc
-- 
c294fc
2.26.2
c294fc