mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
vsprintf: Handle NULL with %pU
At present a NULL pointer passed to printf for a %pU argument will cause U-Boot to access memory at 0. Fix this by adding a check, and print "(null)" instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexander Graf <agraf@suse.de> [agraf: s/(null)/<NULL>/] Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
282a06cbca
commit
d7ae1609a9
1 changed files with 4 additions and 1 deletions
|
@ -407,7 +407,10 @@ static char *uuid_string(char *buf, char *end, u8 *addr, int field_width,
|
|||
break;
|
||||
}
|
||||
|
||||
uuid_bin_to_str(addr, uuid, str_format);
|
||||
if (addr)
|
||||
uuid_bin_to_str(addr, uuid, str_format);
|
||||
else
|
||||
strcpy(uuid, "<NULL>");
|
||||
|
||||
return string(buf, end, uuid, field_width, precision, flags);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue