From 05689fe183e6631da99e7c51a747691dbee0b184 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 4 Dec 2018 15:00:10 -0500 Subject: [PATCH] padding for short messages --- libi2pd/NTCP2.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libi2pd/NTCP2.cpp b/libi2pd/NTCP2.cpp index d8cfb12a..e525baa6 100644 --- a/libi2pd/NTCP2.cpp +++ b/libi2pd/NTCP2.cpp @@ -1056,6 +1056,7 @@ namespace transport { if (len < 3) return 0; len -= 3; + if (msgLen < 256) msgLen = 256; // for short message padding should not be always zero size_t paddingSize = (msgLen*NTCP2_MAX_PADDING_RATIO)/100; if (msgLen + paddingSize + 3 > NTCP2_UNENCRYPTED_FRAME_MAX_SIZE) paddingSize = NTCP2_UNENCRYPTED_FRAME_MAX_SIZE - msgLen -3; if (paddingSize > len) paddingSize = len;