linux: take newline into account for sysfs_get_active_config
authorKarsten Koenig <remur@gmx.net>
Wed, 25 Sep 2013 22:08:16 +0000 (18:08 -0400)
committerLudovic Rousseau <ludovic.rousseau+github@gmail.com>
Sat, 28 Sep 2013 10:05:17 +0000 (12:05 +0200)
bConfigurationValue in sysfs can be 3 digits (1byte value) + 1 new line
= 4 bytes

In it's current form a bConfigurationValue of 128 will be detected as
not null terminated due to the trailing newline, simple fix is to just
extend the array size to 5

libusb/os/linux_usbfs.c
libusb/version_nano.h

index f8defb8..245d235 100644 (file)
@@ -564,7 +564,7 @@ static int op_get_device_descriptor(struct libusb_device *dev,
 static int sysfs_get_active_config(struct libusb_device *dev, int *config)
 {
        char *endptr;
-       char tmp[4] = {0, 0, 0, 0};
+       char tmp[5] = {0, 0, 0, 0, 0};
        long num;
        int fd;
        ssize_t r;
index 736c9b6..a833d52 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10837
+#define LIBUSB_NANO 10839