dcavalca / rpms / grub2

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