From 6d1ad967b894a37f423fd52247df5fcc3bfab1a8 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 18 May 2009 18:26:36 -0700 Subject: xfs segfaults in _FontTransSocketReopen when cloning itself Signed-off-by: Alan Coopersmith --- Xtranssock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Xtranssock.c b/Xtranssock.c index eabb587..f36e3a6 100644 --- a/Xtranssock.c +++ b/Xtranssock.c @@ -528,7 +528,14 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port) ciptr->family = AF_UNIX; memcpy(ciptr->peeraddr, ciptr->addr, sizeof(struct sockaddr)); ciptr->port = rindex(addr->sa_data, ':'); - if (ciptr->port[0] == ':') ciptr->port++; /* port should now point to portnum or NULL */ + if (ciptr->port == NULL) { + if (is_numeric(addr->sa_data)) { + ciptr->port = addr->sa_data; + } + } else if (ciptr->port[0] == ':') { + ciptr->port++; + } + /* port should now point to portnum or NULL */ return ciptr; } -- cgit v1.2.3