aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2018-07-18 14:06:13 +0200
committerKévin Redon <kredon@sysmocom.de>2018-07-18 14:06:23 +0200
commitb60538888fb4f8b78189214421a17a7a5802c063 (patch)
tree66375fc848550b2586ab59f4bb11fcfbf75b4a46
parent680bdaba96f2643ea70441fffc7bf123ae5e91b1 (diff)
cardem: fix USB message parsing
the msg->l2h pointer was not set but used later on, e.g. in dispatch_usb_command_cardem, case SIMTRACE_MSGT_DT_CEMU_SET_ATR): > case SIMTRACE_MSGT_DT_CEMU_SET_ATR: > > atr = (struct cardemu_usb_msg_set_atr *) msg->l2h; > > card_emu_set_atr(ci->ch, atr->atr, atr->atr_len); l2h is by default 0, thus not pointing to the actual message l2h. I wonder how cardem worked worked before with this issue though. Change-Id: Ifbb53dbf478d8dade82251f769e78e1306e77434
-rw-r--r--firmware/libcommon/source/mode_cardemu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/firmware/libcommon/source/mode_cardemu.c b/firmware/libcommon/source/mode_cardemu.c
index 7bb06f9..57d541b 100644
--- a/firmware/libcommon/source/mode_cardemu.c
+++ b/firmware/libcommon/source/mode_cardemu.c
@@ -593,6 +593,7 @@ static void dispatch_usb_command(struct msgb *msg, struct cardem_inst *ci)
usb_buf_free(msg);
return;
}
+ msg->l2h = msg->l1h + sizeof(*sh);
switch (sh->msg_class) {
case SIMTRACE_MSGC_GENERIC:
@@ -604,7 +605,6 @@ static void dispatch_usb_command(struct msgb *msg, struct cardem_inst *ci)
case SIMTRACE_MSGC_MODEM:
/* FIXME: Find out why this fails if used for !=
* MSGC_MODEM ?!? */
- msg->l2h = msg->l1h + sizeof(*sh);
dispatch_usb_command_modem(msg, ci);
break;
default: