transport: fix segfault in transport select
String compare against addresses in range 0 or so due to not checking if there was an active session first. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
This commit is contained in:
parent
ccaa9edf29
commit
daa02f7d84
|
@ -281,13 +281,12 @@ COMMAND_HANDLER(handle_transport_select)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
case 1: /* "select FOO" */
|
case 1: /* "select FOO" */
|
||||||
if(strcmp(session->name, CMD_ARGV[0]) == 0) {
|
if ((session!= NULL) && strcmp(session->name, CMD_ARGV[0]) == 0) {
|
||||||
/* NOP */
|
/* NOP */
|
||||||
LOG_DEBUG("transport '%s' is already selected",
|
LOG_DEBUG("transport '%s' is already selected",
|
||||||
CMD_ARGV[0]);
|
CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* we can't change this session's transport after-the-fact */
|
/* we can't change this session's transport after-the-fact */
|
||||||
if (session) {
|
if (session) {
|
||||||
LOG_ERROR("session's transport is already selected.");
|
LOG_ERROR("session's transport is already selected.");
|
||||||
|
|
Loading…
Reference in New Issue