SECURITY: Avoid decrement of dkim_collect_input if already at 0
[exim.git] / src / src / pdkim / pdkim.c
index f68324097083d73f06ffb93ae4b671b42f246eff..b4301b5f79798861768fb65fcc6d222b269ebe16 100644 (file)
@@ -1003,7 +1003,7 @@ else
       last_sig->next = sig;
       }
 
-    if (--dkim_collect_input == 0)
+    if (dkim_collect_input && --dkim_collect_input == 0)
       {
       ctx->headers = pdkim_prepend_stringlist(ctx->headers, ctx->cur_header->s);
       ctx->cur_header->s[ctx->cur_header->ptr = 0] = '\0';
@@ -1922,6 +1922,7 @@ if (dot_stuffing) ctx->flags = PDKIM_DOT_TERM;
 /* The line-buffer is for message data, hence tainted */
 ctx->linebuf = store_get(PDKIM_MAX_BODY_LINE_LEN, TRUE);
 ctx->dns_txt_callback = dns_txt_callback;
+ctx->cur_header = string_get_tainted(36, TRUE);
 
 return ctx;
 }