From 032538ec5acd9f648b237bd04aa9ae0b16868ee7 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Sun, 7 Apr 2013 14:23:26 +0200 Subject: usb-device: Fix crashing when accessing out of global array usb_flash_protocols in function usb_flash_protocol_to_string --- src/usb-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/usb-device.c') 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]; -- cgit v1.2.3