From: hama Date: Sun, 26 Jun 2016 08:33:25 +0000 (+0200) Subject: ReStringUtils::base64Encode(): buffer overflow X-Git-Url: https://gitweb.hamatoma.de/?a=commitdiff_plain;h=7770dcb2e87dd09660c37607c9d7748439489d78;p=reqt ReStringUtils::base64Encode(): buffer overflow --- diff --git a/base/ReStringUtils.cpp b/base/ReStringUtils.cpp index de2fd59..4f729c8 100644 --- a/base/ReStringUtils.cpp +++ b/base/ReStringUtils.cpp @@ -70,7 +70,7 @@ QByteArray& ReStringUtils::base64Decode(const char* input, int inputLength, QByt * @param output OUT: the encoded string * @return output (for chaining) */ -QByteArray& ReStringUtils::base64Encode(uint8_t const* input, size_t inputLength, QByteArray& output) { +QByteArray& ReStringUtils::base64Encode(uint8_t const* input, int inputLength, QByteArray& output) { output.resize(4 * ((inputLength + 2 - ((inputLength + 2) % 3)) / 3)); uint8_t* outCursor = reinterpret_cast(output.data()); while (inputLength-- > 3) { diff --git a/base/ReStringUtils.hpp b/base/ReStringUtils.hpp index 007da6d..28e3c39 100644 --- a/base/ReStringUtils.hpp +++ b/base/ReStringUtils.hpp @@ -45,7 +45,7 @@ protected: class ReStringUtils { public: static QByteArray& base64Decode(const char *input, int inputLength, QByteArray& output); - static QByteArray& base64Encode(const uint8_t *input, size_t inputLength, QByteArray& output); + static QByteArray& base64Encode(const uint8_t *input, int inputLength, QByteArray& output); static QByteArray& chomp(QByteArray &string, char cc = '\n'); static int countChar(const char* line, char cc); static int count(const char* source, const char* item);