mirror of
https://git.proxmox.com/git/grub2
synced 2025-08-04 01:48:49 +00:00
kern/misc: Always set *end in grub_strtoull()
Currently, if there is an error in grub_strtoull(), *end is not set. This differs from the usual behavior of strtoull(), and also means that some callers may use an uninitialized value for *end. Set *end unconditionally. Signed-off-by: Daniel Axtens <dja@axtens.net> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
2f533a89a8
commit
f41f0af48a
@ -419,6 +419,10 @@ grub_strtoull (const char * restrict str, const char ** const restrict end,
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("overflow is detected"));
|
||||
|
||||
if (end)
|
||||
*end = (char *) str;
|
||||
|
||||
return ~0ULL;
|
||||
}
|
||||
|
||||
@ -430,6 +434,10 @@ grub_strtoull (const char * restrict str, const char ** const restrict end,
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_NUMBER,
|
||||
N_("unrecognized number"));
|
||||
|
||||
if (end)
|
||||
*end = (char *) str;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user