dovecot: Sanitize the headers before logging.

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 8 15:04:56 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/eda51f08e8bf
changeset: 6949:eda51f08e8bf
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 08 15:04:52 2007 +0200
description:
Sanitize the headers before logging.

diffstat:

1 file changed, 3 insertions(+)
src/deliver/deliver.c |    3 +++

diffs (20 lines):

diff -r 6b5f89c41de5 -r eda51f08e8bf src/deliver/deliver.c
--- a/src/deliver/deliver.c	Sat Dec 08 14:59:05 2007 +0200
+++ b/src/deliver/deliver.c	Sat Dec 08 15:04:52 2007 +0200
@@ -107,6 +107,7 @@ get_log_var_expand_table(struct mail *ma
 		{ '\0', NULL }
 	};
 	struct var_expand_table *tab;
+	unsigned int i;
 
 	tab = t_malloc(sizeof(static_tab));
 	memcpy(tab, static_tab, sizeof(static_tab));
@@ -115,6 +116,8 @@ get_log_var_expand_table(struct mail *ma
 	(void)mail_get_first_header(mail, "Message-ID", &tab[1].value);
 	(void)mail_get_first_header(mail, "Subject", &tab[2].value);
 	tab[3].value = deliver_get_address(mail, "From");
+	for (i = 1; tab[i].key != '\0'; i++)
+		tab[i].value = str_sanitize(tab[i].value, 80);
 	return tab;
 }
 


More information about the dovecot-cvs mailing list