mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
smbios: Fix buffer overrun when using path= option
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: bb99f4772f
("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>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Valentin David <valentin.david@canonical.com>
Message-ID: <20250323213622.2581013-1-daan.j.demeyer@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
dfaecc04c4
commit
a7a05f5f6a
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue