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,6 +284,7 @@ complete_file (void)
|
||||||
|
|
||||||
/* Cut away the filename part. */
|
/* Cut away the filename part. */
|
||||||
dirfile = grub_strrchr (dir, '/');
|
dirfile = grub_strrchr (dir, '/');
|
||||||
|
if (dirfile)
|
||||||
dirfile[1] = '\0';
|
dirfile[1] = '\0';
|
||||||
|
|
||||||
/* Iterate the directory. */
|
/* Iterate the directory. */
|
||||||
|
|
Loading…
Reference in a new issue