2
0
mirror of git://git.code.sf.net/p/openocd/code synced 2025-07-23 18:17:14 +10:00
openocd/src
Antonio Borneo c4a7a62262 helper/command: check for malloc failure in __command_name
If malloc fails in __command_name, the following strcpy will
segfault, thus preventing __command_name to return.
The actual calls to command_name() implement the correct check
for the NULL pointer, but propagate error -ENOMEM, that is not
an error value coherent within OpenOCD. Plus, in one case it
overwrites an already detected error.

Check the pointer returned by malloc and, in case of failure,
issue an error message and return the NULL pointer.
Let the caller of command_name() to keep the already detected
error or to return ERROR_FAIL in case of end of memory.

Change-Id: I151a24569409777dd5bc09a3daf5dba2b8e2829b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4838
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-01-16 10:51:28 +00:00
..
flash Add flash support for SiFive's Freedom E platforms 2019-01-11 19:50:09 +00:00
helper helper/command: check for malloc failure in __command_name 2019-01-16 10:51:28 +00:00
jtag drivers/sysfsgpio: fix usage messages 2019-01-14 08:45:35 +00:00
pld Convert to non-recursive make 2016-12-08 16:23:10 +00:00
rtos rtos: check symbol list when updating uCOS-III 2018-10-16 11:59:11 +01:00
server Permit null target on TCL connection 2018-11-13 07:02:58 +00:00
svf svf: improve robustness when processing invalid SVF files 2018-03-13 08:41:21 +00:00
target target/stm8: add missing destroy_reg_param() 2019-01-14 08:46:36 +00:00
transport configure: disable all drivers when zy1000 is enabled 2018-04-09 09:04:46 +01:00
xsvf Convert to non-recursive make 2016-12-08 16:23:10 +00:00
hello.c
hello.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
main.c
Makefile.am Convert to non-recursive make 2016-12-08 16:23:10 +00:00
openocd.c armv8: valgrind memleak fixes 2018-04-10 09:13:02 +01:00
openocd.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00