X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcipher.cpp;fp=src%2Fcore%2Fcipher.cpp;h=a8232a3c1fc29b338fb214d22aa823398e2c9f0f;hp=3f299f40c04fcd24e6071f89f6cb7a60bcdc073c;hb=90803b4288736e6c53d50eeb4fbbe2525be968c3;hpb=310dc3ae20541ec5364a9e70a17f3322adb5723f diff --git a/src/core/cipher.cpp b/src/core/cipher.cpp index 3f299f40..a8232a3c 100644 --- a/src/core/cipher.cpp +++ b/src/core/cipher.cpp @@ -364,6 +364,10 @@ QByteArray Cipher::blowfishECB(QByteArray cipherText, bool direction) } else { + // ECB Blowfish encodes in blocks of 12 chars, so anything else is malformed input + if ((temp.length() % 12) != 0) + return cipherText; + temp = b64ToByte(temp); while ((temp.length() % 8) != 0) temp.append('\0'); } @@ -376,8 +380,13 @@ QByteArray Cipher::blowfishECB(QByteArray cipherText, bool direction) if (!cipher.ok()) return cipherText; - if (direction) + if (direction) { + // Sanity check + if ((temp2.length() % 8) != 0) + return cipherText; + temp2 = byteToB64(temp2); + } return temp2; }