From: dann frazier <dann.frazier@canonical.com>
To: grub-devel@gnu.org
Subject: [PATCH] progress: Check for NULL filename
Date: Wed, 12 Aug 2015 09:53:25 -0600 [thread overview]
Message-ID: <1439394805-8573-1-git-send-email-dann.frazier@canonical.com> (raw)
Avoid a NULL pointer dereference if the upper fs layer hasn't set the
file->name field. Files opened through the grub_net_fs interface currently do
not have this field set (though perhaps they should?).
Signed-off-by: dann frazier <dann.frazier@canonical.com>
---
grub-core/lib/progress.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/grub-core/lib/progress.c b/grub-core/lib/progress.c
index 63a0767..2775554 100644
--- a/grub-core/lib/progress.c
+++ b/grub-core/lib/progress.c
@@ -70,8 +70,7 @@ grub_file_progress_hook_real (grub_disk_addr_t sector __attribute__ ((unused)),
percent = grub_divmod64 (100 * file->progress_offset,
file->size, 0);
- partial_file_name = grub_strrchr (file->name, '/');
- if (partial_file_name)
+ if (file->name && (partial_file_name = grub_strrchr (file->name, '/')))
partial_file_name++;
else
partial_file_name = "";
--
2.5.0
next reply other threads:[~2015-08-12 15:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 15:53 dann frazier [this message]
2015-08-13 7:52 ` [PATCH] progress: Check for NULL filename Andrei Borzenkov
2015-08-13 21:04 ` dann frazier
2015-08-17 18:49 ` Andrei Borzenkov
2015-08-17 21:57 ` [PATCH] Avoid NULL pointer dereference in progress module dann frazier
2015-08-20 17:55 ` Andrei Borzenkov
2015-08-21 14:24 ` Dann Frazier
2015-09-21 15:11 ` Dann Frazier
2015-10-10 8:44 ` Andrei Borzenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439394805-8573-1-git-send-email-dann.frazier@canonical.com \
--to=dann.frazier@canonical.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).