Fix buffer overflow in versaloon interface

The USB buffer will need space for both TMS and TDI buffers.
Each holds tap_buffer_size bytes maximum, so tap_buffer_size must be
smaller than half of usb buf_size.

Change-Id: Id8f39936a894cbd98deb89eec5a859aef1e2b783
Signed-off-by: Joerg Fischer <turboj@gmx.de>
Reviewed-on: http://openocd.zylin.com/1136
Tested-by: jenkins
Reviewed-by: simon qian <simonqian.openocd@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
Joerg Fischer 2013-02-10 21:45:30 +01:00 committed by Spencer Oliver
parent b00b9f2d7d
commit 80f78acf73
1 changed files with 1 additions and 1 deletions

View File

@ -302,7 +302,7 @@ static int vsllink_init(void)
}
/* malloc buffer size for tap */
tap_buffer_size = versaloon_interface.usb_setting.buf_size - 32;
tap_buffer_size = versaloon_interface.usb_setting.buf_size / 2 - 32;
vsllink_free_buffer();
tdi_buffer = (uint8_t *)malloc(tap_buffer_size);
tdo_buffer = (uint8_t *)malloc(tap_buffer_size);