summaryrefslogtreecommitdiff
path: root/Xtranssock.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-05-18 18:26:36 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-05-18 18:26:36 -0700
commit6d1ad967b894a37f423fd52247df5fcc3bfab1a8 (patch)
tree10a58d50435c25d6e2c85d299d7349199b40f232 /Xtranssock.c
parent1e32f79670a6dc0baae2c2622d2b562f41266ea5 (diff)
xfs segfaults in _FontTransSocketReopen when cloning itself
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Diffstat (limited to 'Xtranssock.c')
-rw-r--r--Xtranssock.c9
1 files changed, 8 insertions, 1 deletions
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;
}