aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-06-13 10:58:08 +0000
committerVincent Richard <[email protected]>2005-06-13 10:58:08 +0000
commit97e61dcb08e3e31f8a646d87d641d1afef77bd9a (patch)
treebf0159eec01f0f631e85217a25e7794fc13f71a7 /src
parentFixed memory leak. (diff)
downloadvmime-97e61dcb08e3e31f8a646d87d641d1afef77bd9a.tar.gz
vmime-97e61dcb08e3e31f8a646d87d641d1afef77bd9a.zip
Fixed a bug in word parsing.
Diffstat (limited to 'src')
-rw-r--r--src/word.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/word.cpp b/src/word.cpp
index be7cfc9c..f55a66f3 100644
--- a/src/word.cpp
+++ b/src/word.cpp
@@ -93,7 +93,7 @@ word* word::parseNext(const string& buffer, const string::size_type position,
startPos = pos;
}
// Start of an encoded word
- else if (pos + 6 < end && // 6 = "=?(.+)?(.*)?="
+ else if (pos + 8 < end && // 8 = "=?(.+)?(.+)?(.*)?="
buffer[pos] == '=' && buffer[pos + 1] == '?')
{
// Check whether there is some unencoded text before
@@ -116,7 +116,23 @@ word* word::parseNext(const string& buffer, const string::size_type position,
// ...else find the finish sequence '?=' and return an encoded word
const string::size_type wordStart = pos;
- pos += 4;
+ pos += 2;
+
+ while (pos < end && buffer[pos] != '?')
+ ++pos;
+
+ if (pos < end)
+ {
+ ++pos; // skip '?' between charset and encoding
+
+ while (pos < end && buffer[pos] != '?')
+ ++pos;
+
+ if (pos < end)
+ {
+ ++pos; // skip '?' between encoding and encoded data
+ }
+ }
while (pos < end)
{