Author: rfm
Date: Thu Feb 25 12:47:49 2016
New Revision: 39413

URL: http://svn.gna.org/viewcvs/gnustep?rev=39413&view=rev
Log:
Fix error folding header with non-ascci data

Modified:
    libs/base/trunk/Source/Additions/GSMime.m

Modified: libs/base/trunk/Source/Additions/GSMime.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/Additions/GSMime.m?rev=39413&r1=39412&r2=39413&view=diff
==============================================================================
--- libs/base/trunk/Source/Additions/GSMime.m   (original)
+++ libs/base/trunk/Source/Additions/GSMime.m   Thu Feb 25 12:47:49 2016
@@ -3911,14 +3911,14 @@
   NSString *str, BOOL *ok)
 {
   NSUInteger    pos = 0;
-  NSUInteger    size = [str length];
   BOOL          hadEncodedWord = NO;
 
   *ok = YES;
 
   if (YES == oldStyleFolding)
     {
-      BOOL      needSpace = NO;
+      NSUInteger        size = [str length];
+      BOOL              needSpace = NO;
 
       while (pos < size)
         {
@@ -4048,13 +4048,13 @@
                    */
                   [m appendBytes: ptr + pos length: next - pos];
                   offset += next - pos;
-                  pos = next;
+                  pos += next;
                   if (pos < len)
                     {
                       /* We have more text to output, so fold the line.
                        */
                       [m appendBytes: "\r\n" length: 2];
-                      [m appendBytes: ptr + pos length:1 ];
+                      [m appendBytes: ptr + pos length: 1];
                       pos++;
                       offset = 1;
                     }
@@ -4110,7 +4110,7 @@
                   offset = 1;
                 }
 
-              charLength = quotableLength(ptr + pos, size - pos,
+              charLength = quotableLength(ptr + pos, len - pos,
                 fold - offset - overhead, &quotedLength);
               if (quotedLength > (charLength * 4) / 3)
                 {


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to