]> git.sur5r.net Git - openocd/commit
target, arm_adi_v5: catch two allocation errors
authorTomas Vanek <vanekt@fbl.cz>
Sun, 14 Jan 2018 22:33:44 +0000 (23:33 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 25 Jan 2018 07:20:48 +0000 (07:20 +0000)
commitff623b83fc74d40adcdfb36454393cf307d70f08
treeb04cae8c9a10f7e9f998d7d3f9ad8ba65943fa61
parentedb67962865d5d3cc4a8ec1790b4c8c5327e98fd
target, arm_adi_v5: catch two allocation errors

Command
mdw 0 0x40000000
triggers Segmentation fault on an arm.
Size parameter is a nonsence that may happen e.g. if you
mistype mdw instead of mww.

Add checking for calloc() NULL return in mdb/h/w.

Use calloc() instead of malloc() as multiplication
count * sizeof(uint32_t) overflows for size >= 0x40000000.

Change-Id: I968c944d863d1173ef932a7077d526fccb9381ae
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4349
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
src/target/arm_adi_v5.c
src/target/target.c