mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-25 01:38:33 +03:00
card_emu: Fail with assert in case next_tpdu_state from wrong state
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -286,6 +287,10 @@ process_byte_pts(struct card_handle *ch, uint8_t byte)
|
|||||||
/* FIXME: check PCK */
|
/* FIXME: check PCK */
|
||||||
memcpy(ch->pts.resp, ch->pts.req, sizeof(ch->pts.resp));
|
memcpy(ch->pts.resp, ch->pts.req, sizeof(ch->pts.resp));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
TRACE_DEBUG("process_byte_pts() in invalid state %u\n",
|
||||||
|
ch->pts.state);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
/* calculate the next state and set it */
|
/* calculate the next state and set it */
|
||||||
set_pts_state(ch, next_pts_state(ch));
|
set_pts_state(ch, next_pts_state(ch));
|
||||||
@@ -412,6 +417,9 @@ static enum tpdu_state next_tpdu_state(struct card_handle *ch)
|
|||||||
case TPDU_S_WAIT_TX:
|
case TPDU_S_WAIT_TX:
|
||||||
return TPDU_S_WAIT_TX;
|
return TPDU_S_WAIT_TX;
|
||||||
}
|
}
|
||||||
|
/* we should never reach here */
|
||||||
|
assert(0);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_tpdu_header(struct card_handle *ch)
|
static void send_tpdu_header(struct card_handle *ch)
|
||||||
|
|||||||
Reference in New Issue
Block a user