dcavalca / rpms / grub2

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