usbip-wsl2-instructions icon indicating copy to clipboard operation
usbip-wsl2-instructions copied to clipboard

usbip_device_driver.c:108:2: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]

Open pagkly opened this issue 4 years ago • 2 comments

how to solve this error 1 when make install the usbip tools?

user@DESKTOP-KDJ7PIR:/usr/src/4.19.84-microsoft-standard/tools/usb/usbip$ sudo make install -j 12
Making install in libsrc
make[1]: Entering directory '/usr/src/4.19.84-microsoft-standard/tools/usb/usbip/libsrc'
  CC       libusbip_la-usbip_device_driver.lo
  CC       libusbip_la-usbip_common.lo
usbip_device_driver.c: In function ‘read_usb_vudc_device’:
usbip_device_driver.c:108:2: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-tr
uncation]
  108 |  strncpy(dev->path, path, SYSFS_PATH_MAX);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
usbip_device_driver.c:127:2: error: ‘strncpy’ specified bound 32 equals destination size [-Werror=stringop-tru
ncation]
  127 |  strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:472: libusbip_la-usbip_device_driver.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
usbip_common.c: In function ‘read_usb_device’:
usbip_common.c:229:2: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncatio
n]
  229 |  strncpy(udev->path,  path,  SYSFS_PATH_MAX);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
usbip_common.c:230:2: error: ‘strncpy’ specified bound 32 equals destination size [-Werror=stringop-truncatio
]
  230 |  strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:479: libusbip_la-usbip_common.lo] Error 1
make[1]: Leaving directory '/usr/src/4.19.84-microsoft-standard/tools/usb/usbip/libsrc'
make: *** [Makefile:498: install-recursive] Error 1

thank you

pagkly avatar Apr 17 '20 03:04 pagkly

I've removed the -Werror before running the actual make in files:

  • src/Makefile +2
  • libsrc/Makefile +2
  • Makefile +1

n3rd4i avatar May 01 '20 07:05 n3rd4i

Fixed by the patches in https://github.com/rpasek/usbip-wsl2-instructions/pull/15

dkozel avatar Jun 19 '20 12:06 dkozel