dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone
Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Mon, 11 Jul 2016 10:59:48 -0400
Subject: [PATCH] Fix CLANG error from Coverity (#1154226)

Resolved a null pointer deference warning from coverity.

Related: rhbz#1154226
---
 grub-core/net/url.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/grub-core/net/url.c b/grub-core/net/url.c
index 537019f2c78..146858284cd 100644
--- a/grub-core/net/url.c
+++ b/grub-core/net/url.c
@@ -267,7 +267,12 @@ extract_http_url_info (char *url, int ssl,
     }
 
   l = host_end - host_off;
-  c = *host_end;
+
+  if (host_end == NULL)
+    goto fail;
+  else
+    c = *host_end;
+
   *host_end = '\0';
   *host = grub_strndup (host_off, l);
   *host_end = c;