Make base64 encoding not add random linebreak/feed characters.
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 13 Apr 2015 22:37:39 +0000 (00:37 +0200)
committerArt Cancro <ajc@uncensored.citadel.org>
Sun, 19 Apr 2015 13:04:34 +0000 (09:04 -0400)
libcitadel/lib/b64/cencode.c
libcitadel/lib/tools.c

index e440f37..64720f6 100644 (file)
@@ -92,6 +92,7 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
        case step_A:
                break;
        }
+       *codechar++ = '\r';
        *codechar++ = '\n';
        
        return codechar - code_out;
index bc0cb76..ff35f9e 100644 (file)
@@ -320,10 +320,6 @@ size_t CtdlEncodeBase64(char *dest, const char *source, size_t sourcelen, int li
 
                t = destoffset;
                destoffset += base64_encode_blockend(&(dest[destoffset]), &_state);
-               if (t < destoffset) {
-                       dest[destoffset++] = '\r';
-                       dest[destoffset++] = '\n';
-               }
        }
        else {
                destoffset = base64_encode_block(source, sourcelen, dest, &_state);