Bugfix: null-terminate the path in sockaddr_un before using it.
authorIan Osgood <iosgood@Titania.local>
Thu, 9 Mar 2006 05:56:57 +0000 (21:56 -0800)
committerIan Osgood <iosgood@Titania.local>
Thu, 9 Mar 2006 05:56:57 +0000 (21:56 -0800)
This may fix itermittant connect failures.

src/xcb_auth.c

index 9f2cb5a..fb1d0d3 100644 (file)
@@ -168,7 +168,9 @@ static Xauth *get_authptr(struct sockaddr *sockname, unsigned int socknamelen)
     case AF_UNIX:
        /*block*/ { 
            struct sockaddr_un *su = (struct sockaddr_un *) sockname;
+           char *sockbuf = (char *) sockname;
            assert(sizeof(*su) >= socknamelen);
+           sockbuf[socknamelen] = 0;   /* null-terminate path */
            display = strrchr(su->sun_path, 'X');
            if (display == 0)
                return 0;   /* sockname is mangled somehow */