author | llornkcor <llornkcor> | 2003-05-24 02:07:21 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-05-24 02:07:21 (UTC) |
commit | 694ff39fe4f0f4164edd7a2a80abe6be3a4fa2f9 (patch) (unidiff) | |
tree | 6c3f2a5837e32adf2755de4f90d3590d585f1a96 /noncore/unsupported/mailit/emailhandler.cpp | |
parent | 62d2ddfb5cd77e2637cdf7fe16d76aac04975984 (diff) | |
download | opie-694ff39fe4f0f4164edd7a2a80abe6be3a4fa2f9.zip opie-694ff39fe4f0f4164edd7a2a80abe6be3a4fa2f9.tar.gz opie-694ff39fe4f0f4164edd7a2a80abe6be3a4fa2f9.tar.bz2 |
fix for a few crashes. one being stack overwrite. please test before I commit to 0_99
Diffstat (limited to 'noncore/unsupported/mailit/emailhandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index 59ccd90..39f693d 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -172,14 +172,16 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
172 | pos = in.find(delimiter, 0, FALSE); | 172 | pos = in.find(delimiter, 0, FALSE); |
173 | header = in.left(pos); | 173 | header = in.left(pos); |
174 | body = in.right(in.length() - pos - delimiter.length()); | 174 | body = in.right(in.length() - pos - delimiter.length()); |
175 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) | 175 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) |
176 | body.truncate(body.length()-2); | 176 | body.truncate(body.length()-2); |
177 | 177 | ||
178 | TextParser p(header, lineShift); | 178 | // TextParser p(header, lineShift); |
179 | 179 | TextParser * lp = new TextParser(header, lineShift); | |
180 | #define p (*lp) | ||
181 | |||
180 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { | 182 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { |
181 | pos++; | 183 | pos++; |
182 | if (p.separatorAt(pos) == ' ') { | 184 | if (p.separatorAt(pos) == ' ') { |
183 | mail->from = p.getString(&pos, '<', false); | 185 | mail->from = p.getString(&pos, '<', false); |
184 | mail->from = mail->from.stripWhiteSpace(); | 186 | mail->from = mail->from.stripWhiteSpace(); |
185 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { | 187 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { |
@@ -267,12 +269,13 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
267 | boundary = "--" + boundary; //create boundary field | 269 | boundary = "--" + boundary; //create boundary field |
268 | } | 270 | } |
269 | 271 | ||
270 | if (boundary == "") { //fooled by Mime-Version | 272 | if (boundary == "") { //fooled by Mime-Version |
271 | mail->body = body; | 273 | mail->body = body; |
272 | mail->bodyPlain = body; | 274 | mail->bodyPlain = body; |
275 | delete lp; | ||
273 | return mail; | 276 | return mail; |
274 | } | 277 | } |
275 | 278 | ||
276 | while (body.length() > 0) { | 279 | while (body.length() > 0) { |
277 | pos = body.find(boundary, 0, FALSE); | 280 | pos = body.find(boundary, 0, FALSE); |
278 | pos = body.find(delimiter, pos, FALSE); | 281 | pos = body.find(delimiter, pos, FALSE); |
@@ -335,12 +338,13 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
335 | } | 338 | } |
336 | } | 339 | } |
337 | } else { | 340 | } else { |
338 | mail->bodyPlain = body; | 341 | mail->bodyPlain = body; |
339 | mail->body = body; | 342 | mail->body = body; |
340 | } | 343 | } |
344 | delete lp; | ||
341 | return TRUE; | 345 | return TRUE; |
342 | } | 346 | } |
343 | 347 | ||
344 | bool EmailHandler::getEnclosure(Enclosure *ePtr) | 348 | bool EmailHandler::getEnclosure(Enclosure *ePtr) |
345 | { | 349 | { |
346 | QFile f(ePtr->path + ePtr->name); | 350 | QFile f(ePtr->path + ePtr->name); |