summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-10-15 05:42:00 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-15 12:24:38 -0700
commitfcbf77bf872c28ac3f18261a44af91383f0a2f3d (patch)
tree2fc58c37a0684b142b9758e4457f40dcdfc0c607
parent4073f1b6ab9c70d603b194b1bb415b9e742b245f (diff)
downloadlinux-fcbf77bf872c28ac3f18261a44af91383f0a2f3d.tar.bz2
Staging: ft1000-usb: fix array overflow
The code here is supposed checking if we exited the loop without hitting a break. The problem is that in the error handling "i" is out of bounds and it corrupts memory when we do an info->app_info[i].nRxMsgMiss++. >From the comments, it looks like someone noticed this corruption and updated the code, but didn't totally fix the problem. The correct fix is just to remove nRxMsgMiss++ from the error path. I believe this bug can be triggered remotely. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_hw.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 84985388d80a..0ff89c0d31b3 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -2615,8 +2615,7 @@ int ft1000_poll(void* dev_id) {
}
}
- if (i==(MAX_NUM_APP-1)) { // aelias [+] reason: was out of array boundary
- info->app_info[i].nRxMsgMiss++;
+ if (i == MAX_NUM_APP) {
DEBUG("FT1000:ft1000_parse_dpram_msg: No application matching id = %d\n", ppseudo_hdr->portdest);
// Put memory back to free pool
ft1000_free_buffer(pdpram_blk, &freercvpool);