Core: Filter out 8-bit characters in libusb_get_string_descriptor_ascii
authorРоман Донченко <dpb@corrigendum.ru>
Fri, 21 Dec 2012 23:08:09 +0000 (03:08 +0400)
committerPete Batard <pete@akeo.ie>
Mon, 7 Jan 2013 22:23:13 +0000 (22:23 +0000)
* Closes #68

AUTHORS
libusb/descriptor.c
libusb/version_nano.h

diff --git a/AUTHORS b/AUTHORS
index 8c15bd5..c80f5fa 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -48,3 +48,4 @@ Uri Lublin
 Vasily Khoruzhick
 Vitali Lovich
 Xiaofan Chen
+Роман Донченко
index f3a4132..7e47aae 100644 (file)
@@ -734,7 +734,7 @@ int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev,
                if (di >= (length - 1))
                        break;
 
-               if (tbuf[si + 1]) /* high byte */
+               if ((tbuf[si] & 0x80) || (tbuf[si + 1])) /* non-ASCII */
                        data[di++] = '?';
                else
                        data[di++] = tbuf[si];
index 7ef9604..4a236d7 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10591
+#define LIBUSB_NANO 10592