Check for bad data

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35284 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-07-11 12:57:31 +00:00
parent 186f17482a
commit 855876d49b
2 changed files with 15 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2012-07-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m: Don't accept documents where header lines
contain bytes which can't be converted to a string.
2012-07-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSKeyedArchiver.m:

View file

@ -1538,6 +1538,10 @@ wordData(NSString *word)
[data appendData: d];
bytes = (unsigned char*)[data bytes];
dataEnd = [data length];
/* We need more data, so we have to return YES
* to ask our caller to provide it.
*/
return YES;
}
else
{
@ -2917,6 +2921,12 @@ unfold(const unsigned char *src, const unsigned char *end, BOOL *folded)
encoding: NSUTF8StringEncoding];
}
}
if (nil == s)
{
NSLog(@"Bad header ... illegal characters");
flags.hadErrors = 1;
return nil;
}
[hdr appendString: s];
RELEASE(s);
}