diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index e0a39e06..4c3be4ec 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,8 @@ +2011-02-19 Mike Frysinger + + * src/cmd/cmd_bfin.c (cmd_bfin_run): Make sure the part is a Blackfin before + we try calling functions that don't exist and segfault. + 2011-02-18 Mike Frysinger * src/bfin/bfin-part.c (_bfin_part_init): Add missing "void" to param list. diff --git a/urjtag/src/cmd/cmd_bfin.c b/urjtag/src/cmd/cmd_bfin.c index 15b67d17..f5cb15bc 100644 --- a/urjtag/src/cmd/cmd_bfin.c +++ b/urjtag/src/cmd/cmd_bfin.c @@ -70,6 +70,12 @@ cmd_bfin_run (urj_chain_t *chain, char *params[]) return URJ_STATUS_FAIL; } + if (!part_is_bfin (chain, chain->active_part)) + { + urj_error_set (URJ_ERROR_ILLEGAL_STATE, "not a Blackfin part"); + return URJ_STATUS_FAIL; + } + assert (chain->active_part >= 0 && chain->active_part < chain->parts->len); if (strcmp (params[1], "emulation") == 0)