]> xenbits.xensource.com Git - libvirt.git/commit
libxl_conf: Fix config generation for multiple serial devices
authorRayhan Faizel <rayhan.faizel@gmail.com>
Tue, 17 Sep 2024 17:58:45 +0000 (23:28 +0530)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 2 Oct 2024 14:06:50 +0000 (16:06 +0200)
commitcb2a6ef8b570895cd6ec7d63cd61b49681b9474f
tree360f1593a6828a36a10c34b30de6675f4b9c0f7f
parent655225315c26c2122707ddfd71406a59b9dbca0b
libxl_conf: Fix config generation for multiple serial devices

Currently, an array of libxl_string_list (char **) or in other words,
a triple char pointer is initialized. This is dereferenced to a char ** type
and stored in serial_list, which is NULL at this point. There is an attempt to
reference an element of this serial_list when making a call to
libxlMakeChrdevStr which causes a segmentation fault.

To fix this, we simply allocate an array of char * instead of
libxl_string_list.

This patch also adds testcases to extend coverage over both single serial and
multiple serial cases.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/libxl/libxl_conf.c
tests/libxlxml2domconfigdata/multiple-serial.json [new file with mode: 0644]
tests/libxlxml2domconfigdata/multiple-serial.xml [new file with mode: 0644]
tests/libxlxml2domconfigdata/single-serial.json [new file with mode: 0644]
tests/libxlxml2domconfigdata/single-serial.xml [new file with mode: 0644]
tests/libxlxml2domconfigtest.c