From eb97426c76a0716fbc26e0581ccaaad2426d5c04 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Fri, 21 Oct 2011 18:51:19 +0000 Subject: [PATCH] Use array index 'i' only -after- bounds check Reported by cppcheck git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30815 a1c6a512-1295-4272-9138-f99709370657 --- firmware/usbstack/usb_storage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 8203ad4177..c5fa47fa51 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -343,7 +343,7 @@ static void yearday_to_daymonth(int yd, int y, int *d, int *m) t=tnl; } - while(yd >= t[i] && i<12) + while(i<12 && yd >= t[i]) { yd-=t[i]; i++; @@ -1233,7 +1233,7 @@ static void send_csw(int status) static void copy_padded(char *dest, char *src, int len) { int i=0; - while(src[i]!=0 && i