diff options
Diffstat (limited to 'x11/xtrans/patches')
-rw-r--r-- | x11/xtrans/patches/patch-Xtranssock_c | 14 | ||||
-rw-r--r-- | x11/xtrans/patches/patch-Xtransutil_c | 87 |
2 files changed, 101 insertions, 0 deletions
diff --git a/x11/xtrans/patches/patch-Xtranssock_c b/x11/xtrans/patches/patch-Xtranssock_c new file mode 100644 index 0000000..4d4fc28 --- /dev/null +++ b/x11/xtrans/patches/patch-Xtranssock_c @@ -0,0 +1,14 @@ +$OpenBSD$ + +Index: Xtranssock.c +--- Xtranssock.c.orig ++++ Xtranssock.c +@@ -902,7 +902,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, + } else { + namelen = sizeof (struct sockaddr_in6); + #ifdef SIN6_LEN +- ((struct sockaddr_in6 *)&sockname)->sin6_len = sizeof(sockname); ++ ((struct sockaddr_in6 *)&sockname)->sin6_len = (u_int8_t)sizeof(sockname); + #endif + ((struct sockaddr_in6 *)&sockname)->sin6_family = AF_INET6; + ((struct sockaddr_in6 *)&sockname)->sin6_port = htons(sport); diff --git a/x11/xtrans/patches/patch-Xtransutil_c b/x11/xtrans/patches/patch-Xtransutil_c new file mode 100644 index 0000000..0f26934 --- /dev/null +++ b/x11/xtrans/patches/patch-Xtransutil_c @@ -0,0 +1,87 @@ +$OpenBSD$ + +Index: Xtransutil.c +--- Xtransutil.c.orig ++++ Xtransutil.c +@@ -203,7 +203,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtr + if (!*addrp) + *addrp = malloc (len + 1); + if (*addrp) { +- strcpy ((char *) *addrp, hostnamebuf); ++ strlcpy ((char *) *addrp, hostnamebuf, len + 1); + *addrlenp = len; + } else { + *addrlenp = 0; +@@ -243,6 +243,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr) + char hostnamebuf[256]; + char *networkId = NULL; + const char *transName = ciptr->transptr->TransName; ++ size_t len; + + if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0) + { +@@ -255,9 +256,10 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr) + case AF_UNIX: + { + struct sockaddr_un *saddr = (struct sockaddr_un *) addr; +- networkId = malloc (3 + strlen (transName) + +- strlen (hostnamebuf) + strlen (saddr->sun_path)); +- sprintf (networkId, "%s/%s:%s", transName, ++ len = 3 + strlen (transName) + ++ strlen (hostnamebuf) + strlen (saddr->sun_path); ++ networkId = (char *) malloc (len); ++ snprintf (networkId, len, "%s/%s:%s", transName, + hostnamebuf, saddr->sun_path); + break; + } +@@ -285,14 +287,15 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr) + portnum = ntohs (saddr->sin_port); + + snprintf (portnumbuf, sizeof(portnumbuf), "%d", portnum); +- networkId = malloc (3 + strlen (transName) + +- strlen (hostnamebuf) + strlen (portnumbuf)); +- sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf); ++ len = 3 + strlen (transName) + ++ strlen (hostnamebuf) + strlen (portnumbuf); ++ networkId = (char *) malloc (len); ++ snprintf (networkId, len, "%s/%s:%s", transName, hostnamebuf, ++ portnumbuf); + break; + } + #endif /* defined(TCPCONN) */ + +- + default: + break; + } +@@ -325,6 +328,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) + char *hostname; + char addrbuf[256]; + const char *addr = NULL; ++ size_t len; + + switch (family) + { +@@ -400,17 +404,16 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) + + #endif /* defined(TCPCONN) */ + +- + default: + return (NULL); + } + +- +- hostname = malloc (strlen (ciptr->transptr->TransName) + strlen (addr) + 2); +- strcpy (hostname, ciptr->transptr->TransName); +- strcat (hostname, "/"); ++ len = strlen (ciptr->transptr->TransName) + strlen (addr) + 2; ++ hostname = (char *) malloc (len); ++ strlcpy (hostname, ciptr->transptr->TransName, len); ++ strlcat (hostname, "/", len); + if (addr) +- strcat (hostname, addr); ++ strlcat (hostname, addr, len); + + return (hostname); + } |