1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 08:14:15 +00:00

allow zero length padding

This commit is contained in:
orignal 2022-12-12 14:18:36 -05:00
parent 3458665df8
commit f6ca7c19af

View File

@ -2477,14 +2477,9 @@ namespace transport
size_t paddingSize = rand () & 0x0F; // 0 - 15 size_t paddingSize = rand () & 0x0F; // 0 - 15
if (paddingSize + 3 > len) paddingSize = len - 3; if (paddingSize + 3 > len) paddingSize = len - 3;
else if (paddingSize + 3 < minSize) paddingSize = minSize - 3; else if (paddingSize + 3 < minSize) paddingSize = minSize - 3;
if (paddingSize) buf[0] = eSSU2BlkPadding;
{ htobe16buf (buf + 1, paddingSize);
buf[0] = eSSU2BlkPadding; memset (buf + 3, 0, paddingSize);
htobe16buf (buf + 1, paddingSize);
memset (buf + 3, 0, paddingSize);
}
else
return 0;
return paddingSize + 3; return paddingSize + 3;
} }