Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3737f5e6
Commit
3737f5e6
authored
Oct 02, 2002
by
Jochen Karrer
Committed by
Greg Kroah-Hartman
Oct 02, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: string query fix
Query for stringlen before reading a string in usb.c
parent
1b555543
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
drivers/usb/core/message.c
drivers/usb/core/message.c
+9
-4
No files found.
drivers/usb/core/message.c
View file @
3737f5e6
...
@@ -924,7 +924,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
...
@@ -924,7 +924,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
int
usb_string
(
struct
usb_device
*
dev
,
int
index
,
char
*
buf
,
size_t
size
)
int
usb_string
(
struct
usb_device
*
dev
,
int
index
,
char
*
buf
,
size_t
size
)
{
{
unsigned
char
*
tbuf
;
unsigned
char
*
tbuf
;
int
err
;
int
err
,
len
;
unsigned
int
u
,
idx
;
unsigned
int
u
,
idx
;
if
(
size
<=
0
||
!
buf
||
!
index
)
if
(
size
<=
0
||
!
buf
||
!
index
)
...
@@ -954,10 +954,15 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
...
@@ -954,10 +954,15 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
}
}
/*
/*
* Just ask for a maximum length string and then take the length
* ask for the length of the string
* that was returned.
*/
*/
err
=
usb_get_string
(
dev
,
dev
->
string_langid
,
index
,
tbuf
,
255
);
err
=
usb_get_string
(
dev
,
dev
->
string_langid
,
index
,
tbuf
,
2
);
if
(
err
<
2
)
goto
errout
;
len
=
tbuf
[
0
];
err
=
usb_get_string
(
dev
,
dev
->
string_langid
,
index
,
tbuf
,
len
);
if
(
err
<
0
)
if
(
err
<
0
)
goto
errout
;
goto
errout
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment