hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/tools/usb/usbip/libsrc/usbip_device_driver.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2015 Karol Kosik <karo9@interia.eu>
34 * 2015 Samsung Electronics
....@@ -6,19 +7,6 @@
67 * Based on tools/usb/usbip/libsrc/usbip_host_driver.c, which is:
78 * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
89 * 2005-2007 Takahiro Hirofuchi
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2210 */
2311
2412 #include <fcntl.h>
....@@ -105,7 +93,8 @@
10593 copy_descr_attr16(dev, &descr, idProduct);
10694 copy_descr_attr16(dev, &descr, bcdDevice);
10795
108
- strncpy(dev->path, path, SYSFS_PATH_MAX);
96
+ strncpy(dev->path, path, SYSFS_PATH_MAX - 1);
97
+ dev->path[SYSFS_PATH_MAX - 1] = '\0';
10998
11099 dev->speed = USB_SPEED_UNKNOWN;
111100 speed = udev_device_get_sysattr_value(sdev, "current_speed");
....@@ -124,7 +113,8 @@
124113 dev->busnum = 0;
125114
126115 name = udev_device_get_sysname(plat);
127
- strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
116
+ strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE - 1);
117
+ dev->busid[SYSFS_BUS_ID_SIZE - 1] = '\0';
128118 return 0;
129119 err:
130120 fclose(fd);