Skip to content

Commit

Permalink
Fix message type metadata leakage in websocket protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Jan 11, 2020
1 parent 29d671a commit 6f230c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/websockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,11 @@ void AppDataServer::saveNonceHex(NonceType nt, QString noncehex) {

// Encrypt an outgoing message with the stored secret key.
QString AppDataServer::encryptOutgoing(QString msg) {
int padding = 256;
// This padding size is ~50% larger than current largest
// message size and makes all current message types
// indistinguishable. If some new message type can
// be larger than this, the padding should probably be increased
int padding = 16*1024;
qDebug() << "Encrypt msg(pad="<<padding<<") prepad len=" << msg.length();
if (msg.length() % padding > 0) {
msg = msg + QString(" ").repeated(padding - (msg.length() % padding));
Expand Down

0 comments on commit 6f230c9

Please sign in to comment.