more places to fix the new linebreak behaviour of the base64 encoder.
[citadel.git] / citadel / modules / dspam / serv_dspam.c
index 86e8b30b0539b4b0b9c4dd3cc4a87f40884a3214..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);
+               size_t len = CtdlEncodeBase64(msg->cm_fields[eErrorMsg], CTX->signature->data, CTX->signature->length, 0);
 
-               msg->cm_fields['G'] = malloc (CTX->signature->length * 2);
-               CtdlEncodeBase64(msg->cm_fields['G'], CTX->signature->data, CTX->signature->length, 0);
+               if (msg->cm_fields[eErrorMsg][len - 1] == '\n') {
+                       msg->cm_fields[eErrorMsg][len - 1] = '\0';
+               }
        }
        free(msgtext);