[krbdev.mit.edu #6534] getaddrinfo in src/util/support/fake-addrinfo.c causes leak
The RT System itself via RT
rt-comment at krbdev.mit.edu
Tue Jul 21 15:53:29 EDT 2009
>From krb5-bugs-incoming-bounces at PCH.mit.edu Tue Jul 21 19:53:29 2009
Return-Path: <krb5-bugs-incoming-bounces at PCH.mit.edu>
Received: from pch.mit.edu (PCH.MIT.EDU [18.7.21.90])
by krbdev.mit.edu (Postfix) with ESMTP id 1888ACCA05;
Tue, 21 Jul 2009 19:53:29 +0000 (UTC)
Received: from pch.mit.edu (pch.mit.edu [127.0.0.1])
by pch.mit.edu (8.13.6/8.12.8) with ESMTP id n6LJrSw2011109;
Tue, 21 Jul 2009 15:53:29 -0400
Received: from fort-point-station.mit.edu (FORT-POINT-STATION.MIT.EDU
[18.7.7.76])
by pch.mit.edu (8.13.6/8.12.8) with ESMTP id n6LHcPVk006251
for <krb5-bugs-incoming at PCH.mit.edu>; Tue, 21 Jul 2009 13:38:25 -0400
Received: from mit.edu (W92-130-BARRACUDA-2.MIT.EDU [18.7.21.223])
by fort-point-station.mit.edu (8.13.6/8.9.2) with ESMTP id
n6LHcGVf008229
for <krb5-bugs at mit.edu>; Tue, 21 Jul 2009 13:38:16 -0400 (EDT)
Received: from mss-uk.mssgmbh.com (localhost [127.0.0.1])
by mit.edu (Spam Firewall) with ESMTP id A6BDE5F24B9
for <krb5-bugs at mit.edu>; Tue, 21 Jul 2009 13:38:11 -0400 (EDT)
Received: from mss-uk.mssgmbh.com (mss-uk.mssgmbh.com [217.174.251.109]) by
mit.edu with ESMTP id lQnq33eOzhW3cCby (version=TLSv1
cipher=AES256-SHA bits=256 verify=NO) for <krb5-bugs at mit.edu>;
Tue, 21 Jul 2009 13:38:11 -0400 (EDT)
Received: from fever.mssgmbh.com ([217.111.56.3]) (authenticated bits=0)
by mss-uk.mssgmbh.com (8.13.5.20060308/8.13.5/Debian-3ubuntu1) with
ESMTP id n6LHc8Cp016018
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
for <krb5-bugs at mit.edu>; Tue, 21 Jul 2009 19:38:09 +0200
Received: from fever.mssgmbh.com (localhost [127.0.0.1])
by fever.mssgmbh.com (8.14.3/8.13.8/Debian-3) with ESMTP id
n6LHc3BS022956
for <krb5-bugs at mit.edu>; Tue, 21 Jul 2009 19:38:03 +0200
Received: (from rw at localhost)
by fever.mssgmbh.com (8.14.3/8.13.4/Submit) id n6LHc2df022953;
Tue, 21 Jul 2009 19:38:02 +0200
Date: Tue, 21 Jul 2009 19:38:02 +0200
Message-Id: <200907211738.n6LHc2df022953 at fever.mssgmbh.com>
To: krb5-bugs at mit.edu
Subject:
From: rweikusat at mssgmbh.com
X-send-pr-version: 3.99
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0
(mss-uk.mssgmbh.com [217.174.251.109]);
Tue, 21 Jul 2009 19:38:10 +0200 (CEST)
X-Spam-Score: 4.137
X-Spam-Level: **** (4.137)
X-Spam-Flag: NO
X-Scanned-By: MIMEDefang 2.42
X-Mailman-Approved-At: Tue, 21 Jul 2009 15:53:26 -0400
X-BeenThere: krb5-bugs-incoming at mailman.mit.edu
X-Mailman-Version: 2.1.6
Precedence: list
Reply-To: rweikusat at mssgmbh.com
Sender: krb5-bugs-incoming-bounces at PCH.mit.edu
Errors-To: krb5-bugs-incoming-bounces at PCH.mit.edu
>Submitter-Id: net
>Originator: Rainer Weikusat
>Organization:
MadPartners LTD
>Confidential: no
>Synopsis: getaddrinfo in src/util/support/fake-addrinfo.c causes leak
>Severity: non-critical
>Priority: medium
>Category: krb5-libs
>Class: sw-bug
>Release: 1.7
>Environment:
System: Linux fever 2.6.30 #2 SMP Thu Jun 18 19:35:55 CEST 2009 i686 GNU/Linux
>Description:
The function whose name was given in the synopsis contains a workaround
for a history problem with the glibc getaddrinfo:
Linux libc version 6 (libc-2.2.4.so on Debian) is broken.
[...]
The glibc 2.2.5 sources indicate that the canonical name is
*not* allocated separately, it's just some extra storage tacked
on the end of the addrinfo structure. So, let's try this
approach: If getaddrinfo sets ai_canonname, we'll replace the
*first* one with allocated storage,
This issue was fixed by Ulrich Drepper on 2004/08/17, cf
http://sourceware.org/git/?p=glibc.git;a=commit;f=ChangeLog;h=b93437642453ab93f7da79a15ca29cc66048e828
which implies that the ai_canonname-member has been allocated via strdup
at least since glibc release 2.3.4. The workaround mentionedc above overwrites
this allocated name with a newly allocated one, causing a memory leak.
>How-To-Repeat:
use krb5_sname_to_princiapal
>Fix:
A somewhat crude way to fix this issues is provided by the patch below
(the warning is there because I didn't find the patchlevel anywhere in
the glibc includes, but need this for 2.3.6)
diff -pru krb5-1.7.orig/src/util/support/fake-addrinfo.c krb5-1.7/src/util/support/fake-addrinfo.c
--- krb5-1.7.orig/src/util/support/fake-addrinfo.c 2008-12-01 18:09:59.000000000 +0100
+++ krb5-1.7/src/util/support/fake-addrinfo.c 2009-07-21 19:19:16.000000000 +0200
@@ -140,7 +140,13 @@ extern /*@dependent@*/ char *gai_strerro
#endif
#if defined (__linux__) && defined(HAVE_GETADDRINFO)
+#ifdef __GLIBC_MINOR__
+#if __GLIBC_MINOR__ < 3
# define COPY_FIRST_CANONNAME
+#elif __GLIBC_MINOR__ == 3
+#warning GLIBC 2.3 < 2.3.4 needs COPY_FIRST_CANONNAME
+#endif
+#endif
#endif
#ifdef _AIX
More information about the krb5-bugs
mailing list