tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
linuxPackages.usbip: fix build with gcc9
Franz Pletz
6 years ago
682de190
8b9b91cc
+41
2 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
usbip
default.nix
fix-strncpy-truncation.patch
+4
pkgs/os-specific/linux/usbip/default.nix
···
8
8
patches = [
9
9
# fixes build with gcc8
10
10
./fix-snprintf-truncation.patch
11
11
+
# fixes build with gcc9
12
12
+
./fix-strncpy-truncation.patch
11
13
];
12
14
13
15
nativeBuildInputs = [ autoconf automake libtool ];
14
16
buildInputs = [ udev ];
17
17
+
18
18
+
NIX_CFLAGS_COMPILE = [ "-Wno-error=address-of-packed-member" ];
15
19
16
20
preConfigure = ''
17
21
cd tools/usb/usbip
+37
pkgs/os-specific/linux/usbip/fix-strncpy-truncation.patch
···
1
1
+
diff --git a/tools/usb/usbip/libsrc/usbip_common.c b/tools/usb/usbip/libsrc/usbip_common.c
2
2
+
index bb424638d75b..2fc5837e609a 100644
3
3
+
--- a/tools/usb/usbip/libsrc/usbip_common.c
4
4
+
+++ b/tools/usb/usbip/libsrc/usbip_common.c
5
5
+
@@ -226,8 +226,8 @@ int read_usb_device(struct udev_device *sdev, struct usbip_usb_device *udev)
6
6
+
path = udev_device_get_syspath(sdev);
7
7
+
name = udev_device_get_sysname(sdev);
8
8
+
9
9
+
- strncpy(udev->path, path, SYSFS_PATH_MAX);
10
10
+
- strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE);
11
11
+
+ strncpy(udev->path, path, SYSFS_PATH_MAX-1);
12
12
+
+ strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE-1);
13
13
+
14
14
+
sscanf(name, "%u-%u", &busnum, &devnum);
15
15
+
udev->busnum = busnum;
16
16
+
diff --git a/tools/usb/usbip/libsrc/usbip_device_driver.c b/tools/usb/usbip/libsrc/usbip_device_driver.c
17
17
+
index 5a3726eb44ab..95b416af8b99 100644
18
18
+
--- a/tools/usb/usbip/libsrc/usbip_device_driver.c
19
19
+
+++ b/tools/usb/usbip/libsrc/usbip_device_driver.c
20
20
+
@@ -91,7 +91,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
21
21
+
copy_descr_attr16(dev, &descr, idProduct);
22
22
+
copy_descr_attr16(dev, &descr, bcdDevice);
23
23
+
24
24
+
- strncpy(dev->path, path, SYSFS_PATH_MAX);
25
25
+
+ strncpy(dev->path, path, SYSFS_PATH_MAX-1);
26
26
+
27
27
+
dev->speed = USB_SPEED_UNKNOWN;
28
28
+
speed = udev_device_get_sysattr_value(sdev, "current_speed");
29
29
+
@@ -110,7 +110,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
30
30
+
dev->busnum = 0;
31
31
+
32
32
+
name = udev_device_get_sysname(plat);
33
33
+
- strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
34
34
+
+ strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE-1);
35
35
+
return 0;
36
36
+
err:
37
37
+
fclose(fd);