This patch checks the received register length with the local
configured register length and disconnect on a length missmatch.
Change-Id: I6b112c6b55a9ffb4526f582a384ffa91dc8b792f
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/517
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
bin_buf = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8));
int chars = (DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2);
- /* fix!!! add some sanity checks on packet size here */
+ if ((unsigned int)chars != strlen(separator + 1)) {
+ LOG_ERROR("gdb sent a packet with wrong register size");
+ return ERROR_SERVER_REMOTE_CLOSED;
+ }
gdb_target_to_reg(target, separator + 1, chars, bin_buf);