diff options
author | root <root@rshg047.dnsready.net> | 2011-05-05 19:02:44 +0000 |
---|---|---|
committer | root <root@rshg047.dnsready.net> | 2011-05-05 19:02:44 +0000 |
commit | ef61aa5a9cead170fa18dba44609c32bbf18306a (patch) | |
tree | 82af53ec1018f58868b80cdf680a9c4ec5df1538 /extra/libxcb/xcb_auth-fix-memory-leak.patch | |
parent | ab1410d33401cf1fc4a384bb0b2d9901c8fe8d14 (diff) |
Thu May 5 19:02:44 UTC 2011
Diffstat (limited to 'extra/libxcb/xcb_auth-fix-memory-leak.patch')
-rw-r--r-- | extra/libxcb/xcb_auth-fix-memory-leak.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/extra/libxcb/xcb_auth-fix-memory-leak.patch b/extra/libxcb/xcb_auth-fix-memory-leak.patch new file mode 100644 index 000000000..d1000913a --- /dev/null +++ b/extra/libxcb/xcb_auth-fix-memory-leak.patch @@ -0,0 +1,38 @@ +From 5755582444ad0ba79e661ab3173cc38e9e588d83 Mon Sep 17 00:00:00 2001 +From: Nick Bowler <nbowler@draconx.ca> +Date: Thu, 11 Nov 2010 01:49:41 +0000 +Subject: xcb_auth: Fix memory leak in _xcb_get_auth_info. + +If the initial get_peer_sock_name(getpeername ...) succeeds, the +pointer to allocated memory is overwritten by the later call to +get_peer_sock_name(getsockname ...). Fix that up by freeing +the allocated memory before overwriting the pointer. + +Signed-off-by: Nick Bowler <nbowler@draconx.ca> +Signed-off-by: Julien Danjou <julien@danjou.info> +--- +diff --git a/src/xcb_auth.c b/src/xcb_auth.c +index 1af27fc..4839b78 100644 +--- a/src/xcb_auth.c ++++ b/src/xcb_auth.c +@@ -327,10 +327,15 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display) + if (!info->namelen) + goto no_auth; /* out of memory */ + +- if (!gotsockname && (sockname = get_peer_sock_name(getsockname, fd)) == NULL) ++ if (!gotsockname) + { +- free(info->name); +- goto no_auth; /* can only authenticate sockets */ ++ free(sockname); ++ ++ if ((sockname = get_peer_sock_name(getsockname, fd)) == NULL) ++ { ++ free(info->name); ++ goto no_auth; /* can only authenticate sockets */ ++ } + } + + ret = compute_auth(info, authptr, sockname); +-- +cgit v0.8.3-6-g21f6 |