dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0261-Fix-one-more-coverity-complaint.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
27a4da
From: Peter Jones <pjones@redhat.com>
27a4da
Date: Thu, 25 May 2017 11:27:40 -0400
28f7f8
Subject: [PATCH] Fix one more coverity complaint
27a4da
27a4da
No idea why covscan thinks this is an "added" bug, since the file hasn't
27a4da
changed in 3 years, but... yeah.
27a4da
27a4da
Signed-off-by: Peter Jones <pjones@redhat.com>
27a4da
---
27a4da
 grub-core/normal/completion.c | 3 ++-
27a4da
 1 file changed, 2 insertions(+), 1 deletion(-)
27a4da
27a4da
diff --git a/grub-core/normal/completion.c b/grub-core/normal/completion.c
28f7f8
index 2c9b9e9312a..93aa0d8eda8 100644
27a4da
--- a/grub-core/normal/completion.c
27a4da
+++ b/grub-core/normal/completion.c
27a4da
@@ -284,7 +284,8 @@ complete_file (void)
27a4da
 
27a4da
       /* Cut away the filename part.  */
27a4da
       dirfile = grub_strrchr (dir, '/');
27a4da
-      dirfile[1] = '\0';
27a4da
+      if (dirfile)
27a4da
+	dirfile[1] = '\0';
27a4da
 
27a4da
       /* Iterate the directory.  */
27a4da
       (fs->dir) (dev, dir, iterate_dir, NULL);