}
/* Convert the root hub name string to UTF-8. */
- root_hub_name_utf8 = wc_to_utf8(root_hub_name_wc->RootHubName, size);
+ root_hub_name_utf8 = wc_to_utf8(root_hub_name_wc->RootHubName, size - offsetof(USB_ROOT_HUB_NAME, RootHubName));
free(root_hub_name_wc);
return root_hub_name_utf8;
}
}
/* Convert the external hub name string to UTF-8. */
- ext_hub_name_utf8 = wc_to_utf8(ext_hub_name_wc->NodeName, size);
+ ext_hub_name_utf8 = wc_to_utf8(ext_hub_name_wc->NodeName, size - offsetof(USB_NODE_CONNECTION_NAME, NodeName));
free(ext_hub_name_wc);
return ext_hub_name_utf8;
}
|| desc->bLength % 2)
return NULL;
- return wc_to_utf8(desc->bString, desc->bLength);
+ return wc_to_utf8(desc->bString, desc->bLength - offsetof(USB_STRING_DESCRIPTOR, bString));
}
static void enumerate_hub_ports(struct sp_port *port, HANDLE hub_device,
port->usb_pid = connection_info_ex->DeviceDescriptor.idProduct;
if (connection_info_ex->DeviceDescriptor.iManufacturer)
- port->usb_manufacturer = get_string_descriptor(hub_device,index,
+ port->usb_manufacturer = get_string_descriptor(hub_device, index,
connection_info_ex->DeviceDescriptor.iManufacturer);
if (connection_info_ex->DeviceDescriptor.iProduct)
port->usb_product = get_string_descriptor(hub_device, index,
continue;
}
RegCloseKey(device_key);
- value[sizeof(value)-1] = 0;
+ value[sizeof(value) - 1] = 0;
if (strcmp(value, port->name))
continue;