From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Cédric Le Goater" <clg@redhat.com>, qemu-devel@nongnu.org
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
"Denis V . Lunev" <den@openvz.org>,
"Kevin Wolf" <kwolf@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>, "Stefan Weil" <sw@weilnetz.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Maciej S . Szmigiero" <maciej.szmigiero@oracle.com>,
"Fam Zheng" <fam@euphon.net>,
"Juan Quintela" <quintela@redhat.com>,
"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
"Leonardo Bras" <leobras@redhat.com>
Subject: Re: [PATCH 1/2] util/uuid: Add UUID_STR_LEN definition
Date: Wed, 25 Oct 2023 14:13:50 +0200 [thread overview]
Message-ID: <85e11cd1-cfa1-4410-7938-cf5d120fff95@linaro.org> (raw)
In-Reply-To: <20231025101245.751559-2-clg@redhat.com>
On 25/10/23 12:12, Cédric Le Goater wrote:
> 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>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> include/qemu/uuid.h | 1 +
> block/parallels-ext.c | 2 +-
> block/vdi.c | 2 +-
> hw/core/qdev-properties-system.c | 2 +-
> hw/hyperv/vmbus.c | 4 ++--
> migration/savevm.c | 4 ++--
> tests/unit/test-uuid.c | 2 +-
> util/uuid.c | 2 +-
> 8 files changed, 10 insertions(+), 9 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> diff --git a/include/qemu/uuid.h b/include/qemu/uuid.h
> index e24a1099e45f2dfc330a578d3ccbe74f3e52e6c1..4e7afaf1d5bd5d382fefbd6f6275d69cf25e7483 100644
> --- a/include/qemu/uuid.h
> +++ b/include/qemu/uuid.h
> @@ -79,6 +79,7 @@ typedef struct {
> "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
>
> #define UUID_FMT_LEN 36
> +#define UUID_STR_LEN (UUID_FMT_LEN + 1)
>
> #define UUID_NONE "00000000-0000-0000-0000-000000000000"
After this patch, when do we need UUID_FMT_LEN?
If it is dangerous, better drop it and keep:
#define UUID_STR_LEN (36 + 1)
or
#define UUID_STR_LEN (36 + sizeof('\0'))
next prev parent reply other threads:[~2023-10-25 12:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 10:12 [PATCH 0/2] vfio/pci: Fix buffer overrun when writing the VF token Cédric Le Goater
2023-10-25 10:12 ` [PATCH 1/2] util/uuid: Add UUID_STR_LEN definition Cédric Le Goater
2023-10-25 10:27 ` Juan Quintela
2023-10-25 12:13 ` Philippe Mathieu-Daudé [this message]
2023-10-25 10:12 ` [PATCH 2/2] vfio/pci: Fix buffer overrun when writing the VF token Cédric Le Goater
2023-10-25 10:28 ` Juan Quintela
2023-10-25 19:55 ` Alex Williamson
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=85e11cd1-cfa1-4410-7938-cf5d120fff95@linaro.org \
--to=philmd@linaro.org \
--cc=berrange@redhat.com \
--cc=clg@redhat.com \
--cc=den@openvz.org \
--cc=eduardo@habkost.net \
--cc=fam@euphon.net \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=leobras@redhat.com \
--cc=maciej.szmigiero@oracle.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
/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).