Change in osmo-ccid-firmware[master]: ccid xfers: retru proper error to host instead of asserting

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Hoernchen gerrit-no-reply at lists.osmocom.org
Fri Oct 16 23:05:58 UTC 2020


Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20689 )


Change subject: ccid xfers: retru proper error to host instead of asserting
......................................................................

ccid xfers: retru proper error to host instead of asserting

This could have led to hangs when trying T=1 data blobs where the length
field is not the T=0 length field and is therefore misinterpreted.

Change-Id: Iacdf60e4401f8e287f60ea148b0944d0a3de491d
---
M ccid_common/ccid_slot_fsm.c
1 file changed, 5 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/89/20689/1

diff --git a/ccid_common/ccid_slot_fsm.c b/ccid_common/ccid_slot_fsm.c
index 23577eb..9303010 100644
--- a/ccid_common/ccid_slot_fsm.c
+++ b/ccid_common/ccid_slot_fsm.c
@@ -294,8 +294,11 @@
 	ss->seq = xfb->hdr.bSeq;
 
 	/* must be '0' for TPDU level exchanges or for short APDU */
-	OSMO_ASSERT(xfb->wLevelParameter == 0x0000);
-	OSMO_ASSERT(msgb_length(msg) > xfb->hdr.dwLength);
+	if (xfb->wLevelParameter == 0x0000)
+		return -8;
+
+	if (msgb_length(msg) != xfb->hdr.dwLength)
+		return -1;
 
 	msgb_pull(msg, 10);
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20689
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: Iacdf60e4401f8e287f60ea148b0944d0a3de491d
Gerrit-Change-Number: 20689
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201016/48ea4105/attachment.htm>


More information about the gerrit-log mailing list