$NetBSD: patch-ab,v 1.3 2005/04/13 17:00:14 salo Exp $

--- greylist.c.orig	2005-04-13 05:26:10.000000000 -0400
+++ greylist.c	2005-04-13 12:03:39.000000000 -0400
@@ -21,8 +21,11 @@
 
 ts=time(0);
 strncpy(oip,ip,sizeof(oip)-1);
+oip[sizeof(oip)-1] = '\0';
 strncpy(osender,sender,sizeof(osender)-1);
+osender[sizeof(osender)-1] = '\0';
 strncpy(orecipient,recipient,sizeof(orecipient)-1);
+orecipient[sizeof(orecipient)-1] = '\0';
 
 if(conf->debug==1) printf("%d: Starting the greylist algo\n",pid);
 
@@ -68,10 +71,18 @@
         if(conf->debug==1) printf("%d: lightgrey on domain is on, let's keep the domain only on recipient and sender\n",pid);
 
         domain=(char *)strstr(osender,"@");
-	if(domain!=NULL) strncpy(sender,domain,BLEN-1);
+	if(domain!=NULL)
+		{
+		strncpy(sender,domain,BLEN-1);
+		sender[BLEN-1] = '\0';
+		}
 
         domain=(char *)strstr(orecipient,"@");
-	if(domain!=NULL) strncpy(recipient,domain,BLEN-1);
+	if(domain!=NULL)
+		{
+		strncpy(recipient,domain,BLEN-1);
+		recipient[BLEN-1] = '\0';
+		}
         }
 
 //
@@ -119,6 +130,7 @@
 		if(domain==NULL) domain=osender;
 
 		strncpy(netw,oip,sizeof(netw)-1);
+		netw[sizeof(netw)-1] = '\0';
 		l=strlen(netw);
 		for(i=l-1;i>=0;i--)
 			if(netw[i]=='.')
@@ -148,7 +160,7 @@
 		if(x==4)
 			{
 			snprintf(query,sizeof(query)-1,"%d.%d.%d.%d.%s",d,c,b,a,conf->dnswl);
-			n=DnsIp(query,NULL);
+			n=DnsIp(query,NULL, 0);
 			if(conf->debug==1) printf("%d: DNSQuery=(%s) result=%ld\n",pid,query,n);
 			if(n==0)
 				{
