summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.bsd-wrapper5
-rw-r--r--Xtrans.c3
-rw-r--r--Xtranssock.c2
-rw-r--r--Xtransutil.c28
5 files changed, 28 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index 38c34c3..f11440d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,10 +10,10 @@ Xtransinclude_HEADERS = \
Xtransutil.c \
transport.c
-aclocaldir = $(datadir)/aclocal
+aclocaldir = $(libdir)/aclocal
aclocal_DATA = xtrans.m4
-pkgconfigdir = $(datadir)/pkgconfig
+pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xtrans.pc
MAINTAINERCLEANFILES = ChangeLog INSTALL
diff --git a/Makefile.bsd-wrapper b/Makefile.bsd-wrapper
new file mode 100644
index 0000000..7a2f498
--- /dev/null
+++ b/Makefile.bsd-wrapper
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile.bsd-wrapper,v 1.3 2012/03/10 18:41:37 matthieu Exp $
+
+CONFIGURE_ARGS += --without-fop --without-xmlto
+
+.include <bsd.xorg.mk>
diff --git a/Xtrans.c b/Xtrans.c
index 5d86328..d257872 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -208,6 +208,7 @@ TRANS(ParseAddress) (const char *address,
char *_host, *_port;
char hostnamebuf[256];
int _host_len;
+ size_t len;
prmsg (3,"ParseAddress(%s)\n", address);
@@ -497,6 +498,7 @@ TRANS(Reopen) (int type, int trans_id, int fd, const char *port)
Xtransport *thistrans = NULL;
char *save_port;
int i;
+ size_t len;
prmsg (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port);
@@ -638,6 +640,7 @@ TRANS(GetReopenInfo) (XtransConnInfo ciptr,
{
int i;
+ size_t len;
for (i = 0; i < NUMTRANS; i++)
if (Xtransports[i].transport == ciptr->transptr)
diff --git a/Xtranssock.c b/Xtranssock.c
index 35eaf16..094f15c 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -1029,7 +1029,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, const char *port,
} 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/Xtransutil.c b/Xtransutil.c
index 63f0fc3..f3a280d 100644
--- a/Xtransutil.c
+++ b/Xtransutil.c
@@ -203,7 +203,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
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 = malloc (len);
+ snprintf (networkId, len, "%s/%s:%s", transName,
hostnamebuf, saddr->sun_path);
break;
}
@@ -285,9 +287,11 @@ 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 = malloc (len);
+ snprintf (networkId, len, "%s/%s:%s", transName, hostnamebuf,
+ portnumbuf);
break;
}
#endif /* defined(TCPCONN) */
@@ -325,6 +329,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
char *hostname;
char addrbuf[256];
const char *addr = NULL;
+ size_t len;
switch (family)
{
@@ -405,12 +410,13 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
return (NULL);
}
+ len = strlen (ciptr->transptr->TransName) + strlen (addr) + 2;
+ hostname = malloc (len);
+ strlcpy (hostname, ciptr->transptr->TransName, len);
+ strlcat (hostname, "/", len);
- hostname = malloc (strlen (ciptr->transptr->TransName) + strlen (addr) + 2);
- strcpy (hostname, ciptr->transptr->TransName);
- strcat (hostname, "/");
if (addr)
- strcat (hostname, addr);
+ strlcat (hostname, addr, len);
return (hostname);
}