Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iso7816.c: allow file length stored in more than 2 bytes #459

Closed
wants to merge 2 commits into from
Closed

iso7816.c: allow file length stored in more than 2 bytes #459

wants to merge 2 commits into from

Conversation

vletoux
Copy link
Contributor

@vletoux vletoux commented May 10, 2015

As indicated in chapter 7.4.3 of iso 7816-4, file length, encoded in tag 0x80 or 0x81 can be stored in more than 2 bytes.
As is, the code allows only 2 bytes and check only for the first tag. If there is 2 tags with 4 bytes then 2 bytes, the file size computation fails.
https://github.com/OpenSC/OpenSC/blob/master/src/libopensc/iso7816.c#L362-373

chapter 7 4 3

This patch push the limit to 4 bytes and moreover, if one tag has an incorrect value, it tries the next tag.

@frankmorgner
Copy link
Member

Could you check if sc_asn1_decode_integer can be used for calculating file->size?

@vletoux
Copy link
Contributor Author

vletoux commented May 11, 2015

@frankmorgner sc_asn1_decode_integer seems to be better. I'll upgrade my patch.

@frankmorgner
Copy link
Member

sc_asn1_decode_integer looks for negative values, too. this may be a problem

@vletoux
Copy link
Contributor Author

vletoux commented May 11, 2015

@frankmorgner : done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants