git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel - Fixing and breaking SMP related stuff
[tpg/acess2.git]
/
Modules
/
USB
/
Core
/
usb_lowlevel.c
diff --git
a/Modules/USB/Core/usb_lowlevel.c
b/Modules/USB/Core/usb_lowlevel.c
index
99423a7
..
0e53bad
100644
(file)
--- a/
Modules/USB/Core/usb_lowlevel.c
+++ b/
Modules/USB/Core/usb_lowlevel.c
@@
-122,8
+122,15
@@
char *USB_int_GetDeviceString(tUSBDevice *Dev, int Endpoint, int Index)
struct sDescriptor_String str;
int src_len, new_len;
char *ret;
struct sDescriptor_String str;
int src_len, new_len;
char *ret;
+
+ if(Index == 0) return strdup("");
USB_int_ReadDescriptor(Dev, Endpoint, 3, Index, sizeof(str), &str);
USB_int_ReadDescriptor(Dev, Endpoint, 3, Index, sizeof(str), &str);
+ if(str.Length < 2) {
+ Log_Error("USB", "String %p:%i:%i:%i descriptor is undersized (%i)",
+ Dev->Host, Dev->Address, Endpoint, Index, str.Length);
+ return NULL;
+ }
// if(str.Length > sizeof(str)) {
// // IMPOSSIBLE!
// Log_Error("USB", "String is %i bytes, which is over prealloc size (%i)",
// if(str.Length > sizeof(str)) {
// // IMPOSSIBLE!
// Log_Error("USB", "String is %i bytes, which is over prealloc size (%i)",
@@
-132,6
+139,8
@@
char *USB_int_GetDeviceString(tUSBDevice *Dev, int Endpoint, int Index)
// }
src_len = (str.Length - 2) / sizeof(str.Data[0]);
// }
src_len = (str.Length - 2) / sizeof(str.Data[0]);
+ LOG("&str = %p, src_len = %i", &str, src_len);
+
new_len = _UTF16to8(str.Data, src_len, NULL);
ret = malloc( new_len + 1 );
_UTF16to8(str.Data, src_len, ret);
new_len = _UTF16to8(str.Data, src_len, NULL);
ret = malloc( new_len + 1 );
_UTF16to8(str.Data, src_len, ret);
UCC
git Repository :: git.ucc.asn.au