Hi, > FWIW, most of these have been fixed in the meantime; the only > remaining > hack I had to add was: > > diff --git i/hw/usb/bus.c w/hw/usb/bus.c > index 5939b273b9..bce011058b 100644 > --- i/hw/usb/bus.c > +++ w/hw/usb/bus.c > @@ -407,8 +407,9 @@ void usb_register_companion(const char > *masterbus, > USBPort *ports[], > void usb_port_location(USBPort *downstream, USBPort *upstream, int > portnr) > { > if (upstream) { > - snprintf(downstream->path, sizeof(downstream->path), > "%s.%d", > - upstream->path, portnr); > + int l = snprintf(downstream->path, sizeof(downstream->path), > "%s.%d", > + upstream->path, portnr); > + assert(l < sizeof(downstream->path));
Approach looks ok to me. Maximum hub chain length is 5, number of ports hubs is limited too, you'll never need more that two digits for port numbers. So 2*5 plus 4 connecting dots => 14 chars is the max strlen. path size is 16, so it will fit, including the terminating \0. Trying things like "assert(portnr <= 99)" have no effect on the possible string length calculated by gcc7. cheers, Gerd