From 20074741e7ef7b07367727d3df93c404f41cbdfe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Fri, 5 Oct 2007 21:00:19 +0000 Subject: [PATCH] * zero structs before handing them to getpeername() to silence valgrind. * after looping over the user, we need to append a terminating \0 --- citadel/locate_host.c | 2 ++ citadel/msgbase.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/citadel/locate_host.c b/citadel/locate_host.c index bb2463dae..744bc7e3c 100644 --- a/citadel/locate_host.c +++ b/citadel/locate_host.c @@ -295,6 +295,8 @@ int rbl_check(char *message_to_spammer) { struct sockaddr_in sin; int len; /* should be socklen_t but doesn't work on Macintosh */ + len = 0; + memset (&sin, 0, sizeof (struct sockaddr_in)); if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, (socklen_t *)&len)) { return(rbl_check_addr(&sin.sin_addr, message_to_spammer)); } diff --git a/citadel/msgbase.c b/citadel/msgbase.c index f6d7018b2..90d62a53b 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -3185,6 +3185,7 @@ struct recptypes *validate_recipients(char *supplied_recipients) { mailtype = alias(this_recp); mailtype = alias(this_recp); mailtype = alias(this_recp); + j = 0; for (j=0; !IsEmptyStr(&this_recp[j]); ++j) { if (this_recp[j]=='_') { this_recp_cooked[j] = ' '; @@ -3193,6 +3194,7 @@ struct recptypes *validate_recipients(char *supplied_recipients) { this_recp_cooked[j] = this_recp[j]; } } + this_recp_cooked[j] = '\0'; invalid = 0; switch(mailtype) { case MES_LOCAL: -- 2.39.2