Skip to content

Commit

Permalink
NeoPGPApplet: rework install()
Browse files Browse the repository at this point in the history
Get the offsets correct and drop the "+ 1" when passing the offsets to
the register() and the applet constructor.

Signed-off-by: Michael Walle <[email protected]>
  • Loading branch information
mwalle committed Apr 3, 2024
1 parent e4c5d14 commit b54e014
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/cc/walle/neopgp/NeoPGPApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,16 @@ private boolean hasConfiguration(short mask) {
}

public static void install(byte[] buf, short off, byte len) {
short aidOffset = off;
short aidLength = buf[off];
short infoOffset = (short)(aidOffset + aidLength + 1);
short infoLength = buf[infoOffset];
short paramsOffset = (short)(infoOffset + infoLength + 1);
short paramsLength = buf[paramsOffset];
byte aidLength = buf[off++];
short aidOffset = off; off += (short)(aidLength & 0xff);
byte infoLength = buf[off++];
short infoOffset = off; off += (short)(infoLength & 0xff);
byte paramsLength = buf[off++];
short paramsOffset = off; off += (short)(paramsLength & 0xff);

NeoPGPApplet app = new NeoPGPApplet(buf, (short)(paramsOffset + 1), paramsLength);
NeoPGPApplet app = new NeoPGPApplet(buf, paramsOffset, paramsLength);

app.register(buf, (short)(off + 1), buf[off]);
app.register(buf, aidOffset, aidLength);
app.reset();
}

Expand Down

0 comments on commit b54e014

Please sign in to comment.