summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2013-04-07 14:23:26 +0200
committerPali Rohár <pali.rohar@gmail.com>2013-04-07 14:23:26 +0200
commit032538ec5acd9f648b237bd04aa9ae0b16868ee7 (patch)
treefa01df28d828c1d90f1058b4a1d7985c58436bf6
parent2c34ec70d295f930326c65074883c0d52ccf6794 (diff)
download0xFFFF-032538ec5acd9f648b237bd04aa9ae0b16868ee7.tar.bz2
usb-device: Fix crashing when accessing out of global array usb_flash_protocols in function usb_flash_protocol_to_string
-rw-r--r--src/usb-device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/usb-device.c b/src/usb-device.c
index c36921a..00f83f5 100644
--- a/src/usb-device.c
+++ b/src/usb-device.c
@@ -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];