From 91f8d99265670b25fc373bc5b2d126e96dc49e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20DEL=20NERO?= Date: Tue, 14 Nov 2023 19:46:09 +0100 Subject: [PATCH] buffer overrun. --- lib_jtag_core/src/script/script.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_jtag_core/src/script/script.c b/lib_jtag_core/src/script/script.c index c8e4d3f..aa7a36d 100644 --- a/lib_jtag_core/src/script/script.c +++ b/lib_jtag_core/src/script/script.c @@ -1232,6 +1232,7 @@ char * arrayresize(char * array, int size, unsigned char c) array = malloc(DEFAULT_BUFLEN); if(array) { + size = DEFAULT_BUFLEN / 2; memset(array,0,DEFAULT_BUFLEN); } @@ -1258,7 +1259,7 @@ char * arrayresize(char * array, int size, unsigned char c) } else { - ptr[ (size * 2) ] = 0; + ptr[ (size * 2) - 1 ] = 0; } }