From a4b75cc267c53ac11f1dfe6cc9d81eb0eeb848e9 Mon Sep 17 00:00:00 2001 From: CaS Date: Tue, 9 Mar 2004 12:16:16 +0000 Subject: [PATCH] fix error in uuencoding CVr: ---------------------------------------------------------------------- git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18810 72102866-910b-0410-8b05-ffd578937521 --- Source/Additions/GSMime.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m index 8b998b62e..3e841751d 100644 --- a/Source/Additions/GSMime.m +++ b/Source/Additions/GSMime.m @@ -3127,17 +3127,22 @@ static NSCharacterSet *tokenSet = nil; else if (pos > 6 && strncmp(bytes, "begin ", 6) == 0) { unsigned off = 6; + unsigned end = pos; NSData *d; - while (off < pos && bytes[off] >= '0' && bytes[off] <= '7') + if (end > off && bytes[end-1] == '\r') + { + end--; + } + while (off < end && bytes[off] >= '0' && bytes[off] <= '7') { off++; } - while (off < pos && bytes[off] == ' ') + while (off < end && bytes[off] == ' ') { off++; } - d = [NSData dataWithBytes: &bytes[off] length: pos - off]; + d = [NSData dataWithBytes: &bytes[off] length: end - off]; name = [[NSString alloc] initWithData: d encoding: NSASCIIStringEncoding]; AUTORELEASE(name); @@ -3329,7 +3334,7 @@ static NSCharacterSet *tokenSet = nil; /* * Now we encode the actual data for the line. */ - for (pos = 0; count > 0; count -= 3, pos += 3) + for (pos = 0; count > 0; count -= 3) { unsigned char tmp[3]; int c;