Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] [PATCH] bug in autowhite_timeout()

2006-08-08 by Hajimu UMEMOTO

Hi,

>>> Tue, 08 Aug 2006 09:27:09 +0900,
>>> Hajimu UMEMOTO <ume@...> said:

>>>>> On Mon, 7 Aug 2006 23:44:06 +0200
>>>>> Fabien Tassin <fta+miltergreylist@...> said:

ume> fta+miltergreylist> iptostring() called by autowhite_timeout() is not able to
ume> fta+miltergreylist> resolve AF_INET6 addresses.
ume> fta+miltergreylist> The size of the buffer should not use IPADDRLEN but IPADDRSTRLEN.
ume> fta+miltergreylist> Now works for me.

ume> Yes, it seems there are more places to be fixed as well.

ume> fta+miltergreylist> +                       char buf[IPADDRSTRLEN + 1];
 
ume> You don't need adding 1 to IPADDRSTRLEN.  Just use IPADDRSTRLEN.

Here is a patch:

Index: autowhite.c
diff -u -p autowhite.c.orig autowhite.c
--- autowhite.c.orig	Tue Aug  1 23:55:20 2006
+++ autowhite.c	Tue Aug  8 11:04:23 2006
@@ -124,7 +124,7 @@ autowhite_timeout(void)
 		 * Expiration
 		 */
 		if (aw->a_tv.tv_sec < now.tv_sec) {
-			char buf[IPADDRLEN + 1];
+			char buf[IPADDRSTRLEN];
 
 			iptostring(aw->a_sa, aw->a_salen, buf, sizeof(buf));
                       syslog(LOG_INFO, "(local): addr %s from %s rcpt %s: "
@@ -196,7 +196,7 @@ autowhite_add(sa, salen, from, rcpt, dat
 		 * Expiration (left this one in too until the list gets sorted)
 		 */
 		if (aw->a_tv.tv_sec < now.tv_sec) {
-			char buf[IPADDRLEN + 1];
+			char buf[IPADDRSTRLEN];
 
 			iptostring(aw->a_sa, aw->a_salen, buf, sizeof(buf));
                       syslog(LOG_INFO, "(local): addr %s from %s rcpt %s: "
@@ -486,7 +486,7 @@ autowhite_del_addr(sa, salen)
 		next_aw = TAILQ_NEXT(aw, a_list);
 		
 		if (memcmp(sa, aw->a_sa, salen) == 0) {
-			char buf[IPADDRLEN + 1];
+			char buf[IPADDRSTRLEN];
 
 			iptostring(aw->a_sa, aw->a_salen, buf, sizeof(buf));
                       syslog(LOG_INFO, "(local): addr %s from %s rcpt %s: "
Index: milter-greylist.c
diff -u -p milter-greylist.c.orig milter-greylist.c
--- milter-greylist.c.orig	Wed Aug  2 06:29:36 2006
+++ milter-greylist.c	Tue Aug  8 11:05:35 2006
@@ -264,7 +264,7 @@ mlfi_envfrom(ctx, envfrom)
 	if ((conf.c_nospf == 0) && 
 	    (SPF_CHECK(SA(&priv->priv_addr), priv->priv_addrlen,
 	    priv->priv_helo, *envfrom) != EXF_NONE)) {
-		char ipstr[IPADDRLEN + 1];
+		char ipstr[IPADDRSTRLEN];
 
 		if (iptostring(SA(&priv->priv_addr),
 		    priv->priv_addrlen, ipstr, sizeof(ipstr))) {


Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@...  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.