From 968cad3328d394075fef28492bf94fb8d8388d13 Mon Sep 17 00:00:00 2001 From: Vladimir Kolesnikov Date: Sun, 10 Feb 2013 16:43:24 +0200 Subject: [PATCH] Fix crash in decode() on malformed input --- src/quotedprintable.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/quotedprintable.cpp b/src/quotedprintable.cpp index 34d170c..fceaca5 100644 --- a/src/quotedprintable.cpp +++ b/src/quotedprintable.cpp @@ -48,7 +48,9 @@ QByteArray QuotedPrintable::decode(const QString &input) QByteArray output; - for (int i = 0; i < input.length(); ++i) + int len = input.length(); + int i; + for (i = 0; i < len-2; ++i) { if (input.at(i).toLatin1() == '=') { @@ -61,5 +63,10 @@ QByteArray QuotedPrintable::decode(const QString &input) } } + while (i