From 50b6c623d619a62d804f1f33ba3757c5ec2157ed Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sat, 3 Nov 2012 19:04:27 +1300 Subject: [PATCH] Check for null pointer before decalaring register array. --- src/gdb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gdb_main.c b/src/gdb_main.c index 8c5f6d4..952b0e3 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -84,8 +84,8 @@ gdb_main(void) switch(pbuf[0]) { /* Implementation of these is mandatory! */ case 'g': { /* 'g': Read general registers */ - uint32_t arm_regs[cur_target->regs_size]; ERROR_IF_NO_TARGET(); + uint32_t arm_regs[cur_target->regs_size]; target_regs_read(cur_target, (void*)arm_regs); gdb_putpacket(hexify(pbuf, (void*)arm_regs, cur_target->regs_size), cur_target->regs_size * 2); break; @@ -110,8 +110,8 @@ gdb_main(void) break; } case 'G': { /* 'G XX': Write general registers */ - uint32_t arm_regs[cur_target->regs_size]; ERROR_IF_NO_TARGET(); + uint32_t arm_regs[cur_target->regs_size]; unhexify((void*)arm_regs, &pbuf[1], cur_target->regs_size); target_regs_write(cur_target, arm_regs); gdb_putpacket("OK", 2);