Browse Source

allow zero length padding

pull/1827/head
orignal 2 years ago
parent
commit
f6ca7c19af
  1. 11
      libi2pd/SSU2Session.cpp

11
libi2pd/SSU2Session.cpp

@ -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;
} }

Loading…
Cancel
Save