GNU GRUB - Bugs: bug #52007, errno not correctly managed in...
You are not allowed to post comments on this tracker with your current authentication level.
bug #52007: errno not correctly managed in grub_file_open (kern/file.c)
Submitter: | cedric <cedric_nokia> | ||
Submitted: | Wed 13 Sep 2017 07:53:36 AM UTC | ||
Category: | Filesystem | Severity: | Major |
Priority: | 5 - Normal | Item Group: | Software Error |
Status: | None | Privacy: | Public |
Assigned to: | None | Originator Name: | Cedric |
Open/Closed: | Open | Release: | 2.02 |
Release: | Reproducibility: | Every Time | |
Planned Release: | None |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
No changes have been made to this item
Powered by Savane 3.13-f8d8.
Corresponding source code
In function grub_file_open(), grub_errno is used without been initialized before the call to grub_file_get_device_name().
Unfortunately, the NULL return value of grub_file_get_device_name() can be a valid result. So it doesn't allow to know if an error has occurred inside it. And by consequence, we don't know if grub_errno must be tested or not.
Reproducible: call a function that set grub_errno to an error value then call grub_file_open with a valid file.
Fix: grub_errno should be reset before the call to grub_file_get_device_name().
BR, Cedric.
-------------------------------------------
grub_file_open (const char *name)
{
grub_device_t device = 0;
grub_file_t file = 0, last_file = 0;
char *device_name;
const char *file_name;
grub_file_filter_id_t filter;
device_name = grub_file_get_device_name (name);
if (grub_errno)
goto fail;