stlink: swo: use completely the available buffer
commit8132b77d612e88167e8f0c7bdc6aa9df3661fd4e
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 13 Feb 2021 22:28:16 +0000 (13 23:28 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Wed, 10 Mar 2021 21:36:01 +0000 (10 21:36 +0000)
tree8ebbdc682f1960a9e5a58eca789c7b06b2f00627
parenta2569438380566a8eee339006f1923d4c147850d
stlink: swo: use completely the available buffer

The buffer passed to stlink_usb_trace_read() is allocated of size
*size and does not need to be zero-terminated. There is no reason
to not fill its last byte.

When checking the bytes available on swo, limit the retrieved byte
length to *size.

Change-Id: Iade0f8963118695931f13a8a3f1ab204911236b6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/6061
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
src/jtag/drivers/stlink_usb.c