From 7770dcb2e87dd09660c37607c9d7748439489d78 Mon Sep 17 00:00:00 2001 From: hama Date: Sun, 26 Jun 2016 10:33:25 +0200 Subject: [PATCH] ReStringUtils::base64Encode(): buffer overflow --- base/ReStringUtils.cpp | 2 +- base/ReStringUtils.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); -- 2.39.5