normal/completion: Fix possible NULL pointer dereference
Coverity Scan reports that the grub_strrchr() function can return NULL if the character is not found. Check if that's the case for dirfile pointer. Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
8d88ae92b5
commit
f0f97576e0
1 changed files with 2 additions and 1 deletions
|
@ -284,7 +284,8 @@ complete_file (void)
|
|||
|
||||
/* Cut away the filename part. */
|
||||
dirfile = grub_strrchr (dir, '/');
|
||||
dirfile[1] = '\0';
|
||||
if (dirfile)
|
||||
dirfile[1] = '\0';
|
||||
|
||||
/* Iterate the directory. */
|
||||
(fs->fs_dir) (dev, dir, iterate_dir, NULL);
|
||||
|
|
Loading…
Reference in a new issue