more places to fix the new linebreak behaviour of the base64 encoder.
[citadel.git] / citadel / modules / dspam / serv_dspam.c
index 28a9a8d742804f510ced72809e1986581d768237..7454634f780cd040d428ae9e9543fa9da0d41aa7 100644 (file)
@@ -167,9 +167,13 @@ void dspam_do_msg(long msgnum, void *userdata)
        else
        {
 /* Copy to a safe place */
-
+               // TODO: len -> cm_fields?
                msg->cm_fields[eErrorMsg] = malloc (CTX->signature->length * 2);
-               CtdlEncodeBase64(msg->cm_fields[eErrorMsg], CTX->signature->data, CTX->signature->length, 0);
+               size_t len = CtdlEncodeBase64(msg->cm_fields[eErrorMsg], CTX->signature->data, CTX->signature->length, 0);
+
+               if (msg->cm_fields[eErrorMsg][len - 1] == '\n') {
+                       msg->cm_fields[eErrorMsg][len - 1] = '\0';
+               }
        }
        free(msgtext);