From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Daan De Meyer <daan.j.demeyer@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] smbios: Fix buffer overrun when using path= option
Date: Mon, 24 Mar 2025 09:12:53 +0000 [thread overview]
Message-ID: <Z-EiFdVNiVJVwOqn@redhat.com> (raw)
In-Reply-To: <20250323213622.2581013-1-daan.j.demeyer@gmail.com>
On Sun, Mar 23, 2025 at 10:35:54PM +0100, Daan De Meyer wrote:
> We have to make sure the array of bytes read from the path= file
> is null-terminated, otherwise we run into a buffer overrun later on.
>
> Fixes: bb99f4772f54017490e3356ecbb3df25c5d4537f ("hw/smbios: support loading OEM strings values from a file")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2879
>
> Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
> ---
> hw/smbios/smbios.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 02a09eb9cd..ad4cd6721e 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -1285,6 +1285,9 @@ static int save_opt_one(void *opaque,
> g_byte_array_append(data, (guint8 *)buf, ret);
> }
>
> + buf[0] = '\0';
> + g_byte_array_append(data, (guint8 *)buf, 1);
> +
> qemu_close(fd);
>
> *opt->dest = g_renew(char *, *opt->dest, (*opt->ndest) + 1);
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-03-24 9:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-23 21:35 [PATCH] smbios: Fix buffer overrun when using path= option Daan De Meyer
2025-03-24 6:24 ` Thomas Huth
2025-04-08 14:13 ` Stefan Hajnoczi
2025-03-24 9:12 ` Daniel P. Berrangé [this message]
2025-03-24 13:22 ` Daniel P. Berrangé
2025-03-31 22:18 ` Philippe Mathieu-Daudé
2025-04-03 19:29 ` Daan De Meyer
2025-04-03 19:37 ` Philippe Mathieu-Daudé
2025-04-04 14:46 ` Valentin David
2025-04-04 15:02 ` Philippe Mathieu-Daudé
2025-04-04 15:06 ` Valentin David
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=Z-EiFdVNiVJVwOqn@redhat.com \
--to=berrange@redhat.com \
--cc=daan.j.demeyer@gmail.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.