* zero structs before handing them to getpeername() to silence valgrind.
authorWilfried Göesgens <willi@citadel.org>
Fri, 5 Oct 2007 21:00:19 +0000 (21:00 +0000)
committerWilfried Göesgens <willi@citadel.org>
Fri, 5 Oct 2007 21:00:19 +0000 (21:00 +0000)
* after looping over the user, we need to append a terminating \0

citadel/locate_host.c
citadel/msgbase.c

index bb2463dae9616bff444dde7dca6706dda704c9ec..744bc7e3c76e2296b694616e3695659f43fe791a 100644 (file)
@@ -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));
        }
index f6d7018b2279cdd0a7fa37625287122281949aea..90d62a53b2f77f6754fd8294798c76ddfc5a590f 100644 (file)
@@ -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: