nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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