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
This commit is contained in:
Kévin Redon
2018-07-18 14:06:13 +02:00
parent 680bdaba96
commit b60538888f

View File

@@ -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: