* [PATCH] hw/smbios/smbios.c: Add missing NUL terminal to string from path= parameter
@ 2025-03-26 15:52 Valentin David
2025-03-26 16:47 ` Daniel P. Berrangé
0 siblings, 1 reply; 2+ messages in thread
From: Valentin David @ 2025-03-26 15:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Ani Sinha, Igor Mammedov, Michael S. Tsirkin, Valentin David
Without it, it seems the data gets garbage at the end of the string.
Signed-off-by: Valentin David <valentin.david@canonical.com>
---
hw/smbios/smbios.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 02a09eb9cd..7522e9a172 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1283,6 +1283,7 @@ static int save_opt_one(void *opaque,
return -1;
}
g_byte_array_append(data, (guint8 *)buf, ret);
+ g_byte_array_append(data, (guint8 *)"\0", 1);
}
qemu_close(fd);
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] hw/smbios/smbios.c: Add missing NUL terminal to string from path= parameter
2025-03-26 15:52 [PATCH] hw/smbios/smbios.c: Add missing NUL terminal to string from path= parameter Valentin David
@ 2025-03-26 16:47 ` Daniel P. Berrangé
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2025-03-26 16:47 UTC (permalink / raw)
To: Valentin David
Cc: qemu-devel, Ani Sinha, Igor Mammedov, Michael S. Tsirkin,
Valentin David
On Wed, Mar 26, 2025 at 04:52:54PM +0100, Valentin David wrote:
> Without it, it seems the data gets garbage at the end of the string.
>
> Signed-off-by: Valentin David <valentin.david@canonical.com>
> ---
> hw/smbios/smbios.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 02a09eb9cd..7522e9a172 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -1283,6 +1283,7 @@ static int save_opt_one(void *opaque,
> return -1;
> }
> g_byte_array_append(data, (guint8 *)buf, ret);
> + g_byte_array_append(data, (guint8 *)"\0", 1);
That is inside the loop body, so it is appending an extra '\0' after
every 'read'.
The fix for this issue is posted here
https://lists.nongnu.org/archive/html/qemu-devel/2025-03/msg05826.html
> }
>
> qemu_close(fd);
> --
> 2.48.1
>
>
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 :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-26 16:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-26 15:52 [PATCH] hw/smbios/smbios.c: Add missing NUL terminal to string from path= parameter Valentin David
2025-03-26 16:47 ` Daniel P. Berrangé
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.