NTCP2 (ticket #2286):

Fix error sending large message
Fix NPE after handshake failure
This commit is contained in:
zzz
2018-07-21 13:11:41 +00:00
parent 2800791f00
commit 292b7e6dc1
4 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,13 @@
2018-07-21 zzz
* Build: Add check for libtaglibs package in debian builds
* Console: Add netdb search by transport
* i2psnark: Sequential order option for single-file torrents (ticket #2234)
* NTCP2:
- Fix error sending large message (ticket #2286)
- Fix NPE after handshake failure (ticket #2286)
- Reduce log levels
* Tests: Backport EdDSA junit changes; fixes NPE in 2 tests
2018-07-16 zzz
* Console: Fix HTML error on /configservice w/o wrapper

View File

@ -95,8 +95,9 @@ public class TunnelGatewayMessage extends FastI2NPMessageImpl {
curIndex += 2;
// where is this coming from?
if (curIndex + _msgData.length > out.length) {
_log.log(Log.ERROR, "output buffer too small idx: " + curIndex + " len: " + _msgData.length + " outlen: " + out.length);
throw new I2NPMessageException("Too much data to write out (id=" + _tunnelId + " data=" + _msg + ")");
String txt = "output buffer too small idx: " + curIndex + " len: " + _msgData.length + " outlen: " + out.length;
_log.error(txt);
throw new I2NPMessageException(txt);
}
System.arraycopy(_msgData, 0, out, curIndex, _msgData.length);
curIndex += _msgData.length;

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 15;
public final static long BUILD = 16;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -905,7 +905,8 @@ public class NTCPConnection implements Closeable {
blocks.add(block);
size += block.getTotalLength();
}
sendNTCP2(buf.unencrypted, blocks);
byte[] tmp = size <= BUFFER_SIZE ? buf.unencrypted : new byte[size];
sendNTCP2(tmp, blocks);
}
/**
@ -1820,6 +1821,7 @@ public class NTCPConnection implements Closeable {
_establishedOn = _context.clock().now();
_nextMetaTime = Long.MAX_VALUE;
_nextInfoTime = Long.MAX_VALUE;
_paddingConfig = OUR_PADDING;
sendTermination(reason, 0);
try { Thread.sleep(NTCP2_TERMINATION_CLOSE_DELAY); } catch (InterruptedException ie) {}
close();