mirror of https://gerrit.osmocom.org/libosmocore
reader: more meaningful null pointer check in get_sw
At the moment msgb_apdu_de(resp) is used to check if the msgb that is handed over to get_sw is properly populated with data. However, since msgb_apdu_de() is just adding an offset, which cannot be 0 to ->l2h the returned value also can never be NULL. This means that we cannot use msgb_apdu_de() to detect if resp contains a nullpointer. Lets check if ->l2h is not NULL instead. This will make sure that ->l2h is populated. Change-Id: I32bc56c9264c01911a4f4b4f911b09e955205010 Related: OS#5560
This commit is contained in:
parent
32aff359ae
commit
9802c14489
|
@ -40,7 +40,7 @@ static int get_sw(struct msgb *resp)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (!msgb_apdu_de(resp) || msgb_apdu_le(resp) < 2)
|
||||
if (!resp->l2h || msgb_apdu_le(resp) < 2)
|
||||
return -EIO;
|
||||
|
||||
ret = msgb_get_u16(resp);
|
||||
|
|
Loading…
Reference in New Issue