X-Git-Url: http://git.draconx.ca/gitweb/gentoo-draconx.git/blobdiff_plain/17186df6e6662803c1d9e52e205dc8e06fa76b35..f326c3ebee3a2db25bfc7246260de1e12415fa41:/x11-libs/libxcb/files/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch diff --git a/x11-libs/libxcb/files/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch b/x11-libs/libxcb/files/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch new file mode 100644 index 0000000..91805b1 --- /dev/null +++ b/x11-libs/libxcb/files/0001-xcb_auth-Fix-memory-leak-in-_xcb_get_auth_info.patch @@ -0,0 +1,41 @@ +From 2272f6421cabc916fabae78faad568b1c96af618 Mon Sep 17 00:00:00 2001 +From: Nick Bowler +Date: Wed, 10 Nov 2010 10:11:36 -0500 +Subject: [PATCH] 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 +--- + src/xcb_auth.c | 11 ++++++++--- + 1 files changed, 8 insertions(+), 3 deletions(-) + +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); +-- +1.7.2.2 +