Message ID | 20250326155254.2273939-1-valentin.david@canonical.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | hw/smbios/smbios.c: Add missing NUL terminal to string from path= parameter | expand |
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
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);
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(+)