bincimap

Log | Files | Refs | LICENSE

commit 500987c38c33236aca9998043191c92fd605c40c
parent 70f5345963d758a2c927fc66a72abf2b7221ebc2
Author: andreaha <andreaha@b31fe1f4-c0d1-0310-8000-a34f4ae90293>
Date:   Thu, 29 Jan 2004 20:18:04 +0000

- Fix a problem with determining the size of bodyparts
  with no content.


git-svn-id: file:///home/cwright/convert/bincimap/trunk@14 b31fe1f4-c0d1-0310-8000-a34f4ae90293

Diffstat:
Msrc/mime-parsefull.cc | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mime-parsefull.cc b/src/mime-parsefull.cc @@ -238,6 +238,7 @@ int Binc::MimePart::parseFull(const string &toboundary, int &boundarysize) const // CRLF. headerlength = crlfoffset - headerstartoffsetcrlf; bodystartoffsetcrlf = crlfoffset; + bodylength = 0; // If we encounter the end of file, we return 1 as if we found our // parent's terminal boundary. This will cause a safe exit, and @@ -312,9 +313,9 @@ int Binc::MimePart::parseFull(const string &toboundary, int &boundarysize) const // make sure bodylength doesn't overflow bodylength = crlfoffset; - if (bodylength > bodystartoffsetcrlf) { + if (bodylength >= bodystartoffsetcrlf) { bodylength -= bodystartoffsetcrlf; - if (bodylength > (unsigned int) bsize) { + if (bodylength >= (unsigned int) bsize) { bodylength -= (unsigned int) bsize; } else { bodylength = 0; @@ -424,9 +425,9 @@ int Binc::MimePart::parseFull(const string &toboundary, int &boundarysize) const // make sure bodylength doesn't overflow bodylength = crlfoffset; - if (bodylength > bodystartoffsetcrlf) { + if (bodylength >= bodystartoffsetcrlf) { bodylength -= bodystartoffsetcrlf; - if (bodylength > (unsigned int) boundarysize) { + if (bodylength >= (unsigned int) boundarysize) { bodylength -= (unsigned int) boundarysize; } else { bodylength = 0; @@ -642,9 +643,9 @@ int Binc::MimePart::parseFull(const string &toboundary, int &boundarysize) const // make sure bodylength doesn't overflow bodylength = crlfoffset; - if (bodylength > bodystartoffsetcrlf) { + if (bodylength >= bodystartoffsetcrlf) { bodylength -= bodystartoffsetcrlf; - if (bodylength > (unsigned int) boundarysize) { + if (bodylength >= (unsigned int) boundarysize) { bodylength -= (unsigned int) boundarysize; } else { bodylength = 0;