Fix incorrect offset use in setAttributes

This commit is contained in:
Arnaud Fontaine 2017-08-26 15:50:37 +02:00
parent 04a66b376d
commit e8ebf9e6d7

View File

@ -122,15 +122,15 @@ public final class PGPKey {
return;
}
switch(buf[0]) {
switch(buf[off]) {
case 0x01:
if(len != 6) {
ISOException.throwIt(ISO7816.SW_WRONG_DATA);
return;
}
if((Util.getShort(buf, (short)1) < 2048) ||
(Util.getShort(buf, (short)3) != 0x11) ||
(buf[5] < 0) || (buf[5] > 3)) {
if((Util.getShort(buf, (short)(off + 1)) < 2048) ||
(Util.getShort(buf, (short)(off + 3)) != 0x11) ||
(buf[(short)(off + 5)] < 0) || (buf[(short)(off + 5)] > 3)) {
ISOException.throwIt(ISO7816.SW_WRONG_DATA);
return;
}