mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
libxl: Fix SEGV in network-attach
When "device/vif" directory exists but is empty l!=NULL, but nb==0, so
l[nb-1] is invalid. Add missing check.
Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
(cherry picked from commit 9f1a6ff38b)
Conflicts:
tools/libxl/libxl.c
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
a12ed39665
commit
21c31a811c
1 file changed
+2
-1
+2
-1
@@ -1207,7 +1207,8 @@ int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic)
|
||||
goto out_free;
|
||||
}
|
||||
if (!(l = libxl__xs_directory(&gc, XBT_NULL,
|
||||
libxl__sprintf(&gc, "%s/device/vif", dompath), &nb))) {
|
||||
libxl__sprintf(gc, "%s/device/vif", dompath), &nb)) ||
|
||||
nb == 0) {
|
||||
nic->devid = 0;
|
||||
} else {
|
||||
nic->devid = strtoul(l[nb - 1], NULL, 10) + 1;
|
||||
|
||||