summaryrefslogtreecommitdiff
path: root/src/target/arm7_9_common.c
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2009-12-31 07:13:16 +0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2009-12-30 16:58:27 -0800
commit3ed254c18aa7fc24cbc692433729ec3819fc5537 (patch)
tree9da912a4f5042d5eb7f97d9100ca0dfa3fc3c24d /src/target/arm7_9_common.c
parent7c5acf8660ddfce4746152e03749b699532f513f (diff)
downloadopenocd_libswd-3ed254c18aa7fc24cbc692433729ec3819fc5537.tar.gz
openocd_libswd-3ed254c18aa7fc24cbc692433729ec3819fc5537.tar.bz2
openocd_libswd-3ed254c18aa7fc24cbc692433729ec3819fc5537.tar.xz
openocd_libswd-3ed254c18aa7fc24cbc692433729ec3819fc5537.zip
ARM7_9: Fix segfaults
Handlers for commands - arm7_9 semihosting <enable | disable> - $_TARGETNAME arp_reset assert 1 didn't check if target has already been examined, and could segfault when using the NULL pointer "arm7_9->eice_cache". Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/target/arm7_9_common.c')
-rw-r--r--src/target/arm7_9_common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c
index e5969806..a09b0ad9 100644
--- a/src/target/arm7_9_common.c
+++ b/src/target/arm7_9_common.c
@@ -2797,6 +2797,12 @@ COMMAND_HANDLER(handle_arm7_9_semihosting_command)
COMMAND_PARSE_ENABLE(CMD_ARGV[0], semihosting);
+ if (!target_was_examined(target))
+ {
+ LOG_ERROR("Target not examined yet");
+ return ERROR_FAIL;
+ }
+
if (arm7_9->has_vector_catch) {
struct reg *vector_catch = &arm7_9->eice_cache
->reg_list[EICE_VEC_CATCH];