nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0205-Fix-CLANG-error-from-Coverity-1154226.patch

4fe85b
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
4fe85b
From: Robert Marshall <rmarshall@redhat.com>
4fe85b
Date: Mon, 11 Jul 2016 10:59:48 -0400
4fe85b
Subject: [PATCH] Fix CLANG error from Coverity (#1154226)
4fe85b
4fe85b
Resolved a null pointer deference warning from coverity.
4fe85b
4fe85b
Related: rhbz#1154226
4fe85b
---
4fe85b
 grub-core/net/url.c | 7 ++++++-
4fe85b
 1 file changed, 6 insertions(+), 1 deletion(-)
4fe85b
4fe85b
diff --git a/grub-core/net/url.c b/grub-core/net/url.c
4fe85b
index 537019f2c78..146858284cd 100644
4fe85b
--- a/grub-core/net/url.c
4fe85b
+++ b/grub-core/net/url.c
4fe85b
@@ -267,7 +267,12 @@ extract_http_url_info (char *url, int ssl,
4fe85b
     }
4fe85b
 
4fe85b
   l = host_end - host_off;
4fe85b
-  c = *host_end;
4fe85b
+
4fe85b
+  if (host_end == NULL)
4fe85b
+    goto fail;
4fe85b
+  else
4fe85b
+    c = *host_end;
4fe85b
+
4fe85b
   *host_end = '\0';
4fe85b
   *host = grub_strndup (host_off, l);
4fe85b
   *host_end = c;