mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
util/uuid: Add UUID_STR_LEN definition
qemu_uuid_unparse() includes a trailing NUL when writing the uuid string and the buffer size should be UUID_FMT_LEN + 1 bytes. Add a define for this size and use it where required. Cc: Fam Zheng <fam@euphon.net> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: "Denis V. Lunev" <den@openvz.org> Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
ba7d12eb8c
commit
721da0396c
8 changed files with 10 additions and 9 deletions
|
@ -51,7 +51,7 @@ int qemu_uuid_is_equal(const QemuUUID *lhv, const QemuUUID *rhv)
|
|||
void qemu_uuid_unparse(const QemuUUID *uuid, char *out)
|
||||
{
|
||||
const unsigned char *uu = &uuid->data[0];
|
||||
snprintf(out, UUID_FMT_LEN + 1, UUID_FMT,
|
||||
snprintf(out, UUID_STR_LEN, UUID_FMT,
|
||||
uu[0], uu[1], uu[2], uu[3], uu[4], uu[5], uu[6], uu[7],
|
||||
uu[8], uu[9], uu[10], uu[11], uu[12], uu[13], uu[14], uu[15]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue