Yahoo Groups archive

Milter-greylist

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

Thread

[PATCH] bug in autowhite_timeout()

[PATCH] bug in autowhite_timeout()

2006-08-07 by Fabien Tassin

Hi,

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

/Fabien

--- autowhite.c.orig    2006-08-01 16:55:20.000000000 +0200
+++ autowhite.c 2006-08-07 23:13:42.000000000 +0200
@@ -124,7 +124,7 @@
                 * Expiration
                 */
                if (aw->a_tv.tv_sec < now.tv_sec) {
-                       char buf[IPADDRLEN + 1];
+                       char buf[IPADDRSTRLEN + 1];
 
                        iptostring(aw->a_sa, aw->a_salen, buf, sizeof(buf));
                       syslog(LOG_INFO, "(local): addr %s from %s rcpt %s: "

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

2006-08-08 by Hajimu UMEMOTO

Hi,

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

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

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

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

Sincerely,

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

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/

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

2006-08-08 by Hajimu UMEMOTO

Hi,

>>>>> On Tue, 8 Aug 2006 07:48:12 +0200
>>>>> manu@... said:

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

manu> Do you send me a jumbo patch for that?

I posted it here already.  If you didn't get it, I'll send it to you,
again.

Sincerely,

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

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.