usb-device: Fix crashing when accessing out of global array usb_flash_protocols in function usb_flash_protocol_to_string
This commit is contained in:
1 parent
2c34ec70d2
commit
032538ec5a
1 file changed
+1
-1
+1
-1
@@ -52,7 +52,7 @@ static const char * usb_flash_protocols[] = {
|
||||
|
||||
const char * usb_flash_protocol_to_string(enum usb_flash_protocol protocol) {
|
||||
|
||||
if ( protocol > sizeof(usb_flash_protocols) )
|
||||
if ( protocol >= sizeof(usb_flash_protocols)/sizeof(usb_flash_protocols[0]) )
|
||||
return NULL;
|
||||
|
||||
return usb_flash_protocols[protocol];
|
||||
|
||||
Reference in new issue
Block a user