From 7aea547b9f955c55e15bac48371ff63027469759 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Mon, 5 Apr 2021 11:17:20 +0000 Subject: [PATCH] Fixed possible segfault on some platforms. We need 'count + 4' device entries, one for the "none" entry and a terminating NULL entry. --- bochs/iodev/usb/usb_common.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bochs/iodev/usb/usb_common.cc b/bochs/iodev/usb/usb_common.cc index 1b41a8eb9..a835c37be 100644 --- a/bochs/iodev/usb/usb_common.cc +++ b/bochs/iodev/usb/usb_common.cc @@ -52,7 +52,7 @@ void bx_usbdev_ctl_c::init(void) count = PLUG_get_plugins_count(PLUGTYPE_USB); usb_module_names = (const char**) malloc(count * sizeof(char*)); - usb_device_names = (const char**) malloc((count + 5) * sizeof(char*)); + usb_device_names = (const char**) malloc((count + 6) * sizeof(char*)); usb_module_id = (Bit8u*) malloc((count + 5) * sizeof(Bit8u)); usb_device_names[0] = "none"; usb_module_id[0] = 0xff;