summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Osgood <iosgood@Titania.local>2006-03-08 21:56:57 -0800
committerIan Osgood <iosgood@Titania.local>2006-03-08 21:56:57 -0800
commit6fb661f3ff2fca342b4ea76d5a583c5e4f53e076 (patch)
tree34b636be97b1c08a4c3d2bb68541bc187acd3668
parent522a6e0eac9adeaac533a5b700f42d85d46e2dd7 (diff)
Bugfix: null-terminate the path in sockaddr_un before using it.
This may fix itermittant connect failures.
-rw-r--r--src/xcb_auth.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/xcb_auth.c b/src/xcb_auth.c
index 9f2cb5a..fb1d0d3 100644
--- a/src/xcb_auth.c
+++ b/src/xcb_auth.c
@@ -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 */