summaryrefslogtreecommitdiff
path: root/mail/gld/patches/patch-ae
diff options
context:
space:
mode:
Diffstat (limited to 'mail/gld/patches/patch-ae')
-rw-r--r--mail/gld/patches/patch-ae95
1 files changed, 95 insertions, 0 deletions
diff --git a/mail/gld/patches/patch-ae b/mail/gld/patches/patch-ae
new file mode 100644
index 00000000000..66f35278cbe
--- /dev/null
+++ b/mail/gld/patches/patch-ae
@@ -0,0 +1,95 @@
+$NetBSD: patch-ae,v 1.1 2005/04/13 16:36:07 salo Exp $
+
+--- sockets.c.orig 2004-10-12 08:39:34.000000000 -0400
++++ sockets.c 2005-04-13 12:06:13.000000000 -0400
+@@ -540,7 +540,7 @@
+ /* */
+ /************************************************/
+
+-int DnsIp(char *host,char *ip)
++int DnsIp(char *host,char *ip, size_t len)
+ {
+ struct hostent *hostptr;
+ struct in_addr *ptr;
+@@ -552,7 +552,11 @@
+
+ ptr=(struct in_addr *) *hostptr->h_addr_list;
+
+-if(ip!=NULL) strcpy(ip,(char *)inet_ntoa(*ptr));
++if(ip!=NULL)
++ {
++ strncpy(ip,(char *)inet_ntoa(*ptr), len - 1);
++ ip[len-1] = '\0';
++ }
+ return(0);
+ }
+
+@@ -572,13 +576,14 @@
+ /* */
+ /************************************************/
+
+-int DnsFQDN(char *host,char *fqdn)
++int DnsFQDN(char *host,char *fqdn, size_t len)
+ {
+ struct hostent *hostptr;
+
+ if((hostptr=(struct hostent *)gethostbyname(host))==NULL) return(S_HOST_ERR);
+
+-strcpy(fqdn,hostptr->h_name);
++strncpy(fqdn,hostptr->h_name, len-1);
++fqdn[len-1] = '\0';
+ return(0);
+
+ }
+@@ -599,7 +604,7 @@
+ /* */
+ /************************************************/
+
+-int DnsName(char *ip,char *fqdn)
++int DnsName(char *ip,char *fqdn, size_t len)
+ {
+
+ struct hostent *hostptr;
+@@ -609,7 +614,8 @@
+
+ if((hostptr=(struct hostent *)gethostbyaddr((char *)&addr,sizeof(struct in_addr),AF_INET))==NULL) return(S_HOST_ERR);
+
+-strcpy(fqdn,hostptr->h_name);
++strncpy(fqdn,hostptr->h_name, len-1);
++fqdn[len-1] = '\0';
+
+ return(0);
+ }
+@@ -631,20 +637,27 @@
+ /* */
+ /************************************************/
+
+-void GetPeerIp(int sock,char *ipfrom,char *hostfrom)
++void GetPeerIp(int sock,char *ipfrom, size_t lip, char *hostfrom, size_t hip)
+ {
+ struct sockaddr_in from;
+ size_t foo=sizeof(struct sockaddr_in);
+ struct hostent *hostptr;
+
+-strcpy(ipfrom,"???.???.???.???");
+-strcpy(hostfrom,"?????");
++strncpy(ipfrom,"???.???.???.???", lip-1);
++ipfrom[lip-1] = '\0';
++strncpy(hostfrom,"?????", hip-1);
++hostfrom[hip-1] = '\0';
+
+ if (getpeername(sock,(struct sockaddr *)&from, &foo) == 0)
+ {
+- strcpy(ipfrom,(char *)inet_ntoa(from.sin_addr));
++ strncpy(ipfrom,(char *)inet_ntoa(from.sin_addr), lip-1);
++ ipfrom[lip-1] = '\0';
+ hostptr=(struct hostent *)gethostbyaddr((char *)&from.sin_addr,sizeof(struct in_addr),AF_INET);
+- if(hostptr!=NULL) strcpy(hostfrom,hostptr->h_name);
++ if(hostptr!=NULL)
++ {
++ strncpy(hostfrom,hostptr->h_name, hip-1);
++ hostfrom[hip-1] = '\0';
++ }
+ }
+ }
+