I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit aaaf437d authored by jrandom's avatar jrandom Committed by zzz
Browse files

skip properly (DataHelper.read confusion)

parent a8a866b5
No related branches found
No related tags found
No related merge requests found
...@@ -287,15 +287,20 @@ jP69nPbh4KLGhF+SD0+0bW4= ...@@ -287,15 +287,20 @@ jP69nPbh4KLGhF+SD0+0bW4=
try { try {
fileInputStream = new FileInputStream(signedFile); fileInputStream = new FileInputStream(signedFile);
long skipped = fileInputStream.skip(Signature.SIGNATURE_BYTES);
if (skipped != Signature.SIGNATURE_BYTES)
return "";
byte[] data = new byte[VERSION_BYTES]; byte[] data = new byte[VERSION_BYTES];
int bytesRead = DataHelper.read(fileInputStream, data, Signature.SIGNATURE_BYTES, VERSION_BYTES); int bytesRead = DataHelper.read(fileInputStream, data);
if (bytesRead != VERSION_BYTES) if (bytesRead != VERSION_BYTES) {
return ""; return "";
}
for (int i = 0; i < VERSION_BYTES; i++) for (int i = 0; i < VERSION_BYTES; i++)
if (data[i] == 0x00) if (data[i] == 0x00) {
return new String(data, 0, i, "UTF-8"); return new String(data, 0, i, "UTF-8");
}
return new String(data, "UTF-8"); return new String(data, "UTF-8");
} catch (UnsupportedEncodingException uee) { } catch (UnsupportedEncodingException uee) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment