mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
fix detection of excess data at end of multipart docs
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33738 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9331172345
commit
6dae192890
1 changed files with 13 additions and 2 deletions
|
@ -2580,7 +2580,8 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
|
||||
while (done == NO)
|
||||
{
|
||||
BOOL found = NO;
|
||||
BOOL found = NO;
|
||||
NSUInteger eol = len;
|
||||
|
||||
/*
|
||||
* Search data for the next boundary.
|
||||
|
@ -2594,7 +2595,6 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
|| buf[lineStart-1] == '\n')
|
||||
{
|
||||
BOOL lastPart = NO;
|
||||
NSUInteger eol;
|
||||
|
||||
lineEnd = lineStart + bLength;
|
||||
eol = lineEnd;
|
||||
|
@ -2620,6 +2620,7 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
}
|
||||
if (eol < len && buf[eol] == '\n')
|
||||
{
|
||||
eol++;
|
||||
flags.wantEndOfLine = 0;
|
||||
found = YES;
|
||||
endedFinalPart = lastPart;
|
||||
|
@ -2771,6 +2772,16 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
|
|||
sectionStart = lineStart;
|
||||
if (endedFinalPart == YES)
|
||||
{
|
||||
if (eol < len)
|
||||
{
|
||||
NSData *excess;
|
||||
|
||||
excess = [[NSData alloc] initWithBytes: buf + eol
|
||||
length: len - eol];
|
||||
ASSIGN(boundary, excess);
|
||||
flags.excessData = 1;
|
||||
[excess release];
|
||||
}
|
||||
lineStart = sectionStart = 0;
|
||||
[data setLength: 0];
|
||||
done = YES;
|
||||
|
|
Loading…
Reference in a new issue