nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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