Add more strict USB string filtering.
Approved by: thompsa (mentor)
This commit is contained in:
parent
8f9750b7fd
commit
b64cf89faf
@ -1018,14 +1018,21 @@ usbd_req_get_string_any(struct usb_device *udev, struct mtx *mtx, char *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Filter by default - we don't allow greater and less than
|
* Filter by default - We only allow alphanumerical
|
||||||
* signs because they might confuse the dmesg printouts!
|
* and a few more to avoid any problems with scripts
|
||||||
|
* and daemons.
|
||||||
*/
|
*/
|
||||||
if ((*s == '<') || (*s == '>') || (!isprint(*s))) {
|
if (isalpha(*s) ||
|
||||||
/* silently skip bad character */
|
isdigit(*s) ||
|
||||||
continue;
|
*s == '-' ||
|
||||||
|
*s == '+' ||
|
||||||
|
*s == ' ' ||
|
||||||
|
*s == '.' ||
|
||||||
|
*s == ',') {
|
||||||
|
/* allowed */
|
||||||
|
s++;
|
||||||
}
|
}
|
||||||
s++;
|
/* silently skip bad character */
|
||||||
}
|
}
|
||||||
*s = 0; /* zero terminate resulting string */
|
*s = 0; /* zero terminate resulting string */
|
||||||
return (USB_ERR_NORMAL_COMPLETION);
|
return (USB_ERR_NORMAL_COMPLETION);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user