From patchwork Sat Sep 13 06:56:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allan McRae X-Patchwork-Id: 2831 Received: (qmail 10177 invoked by alias); 13 Sep 2014 06:56:11 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 10167 invoked by uid 89); 13 Sep 2014 06:56:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: newmailhub.uq.edu.au Message-ID: <5413EA84.3060901@archlinux.org> Date: Sat, 13 Sep 2014 16:56:04 +1000 From: Allan McRae User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: libc-alpha Subject: Segfault in getifaddrs_internal in glibc-2.20 X-UQ-FilterTime: 1410591366 Hi, An Arch Linux user has encountered a segfault in getifaddrs_internal: https://sourceware.org/bugzilla/show_bug.cgi?id=17371 This patch is posted there: This seems to fix the issue for them. After looking at the code for a long time, I am still not sure if this is the correct fix. Can anyone confirm/deny? Thanks, Allan diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c index 2c04e17..1fa4960 100644 --- a/sysdeps/unix/sysv/linux/ifaddrs.c +++ b/sysdeps/unix/sysv/linux/ifaddrs.c @@ -774,7 +774,7 @@ getifaddrs_internal (struct ifaddrs **ifap) unsigned int preflen; if ((max_prefixlen > 0) && - (ifam->ifa_prefixlen > max_prefixlen)) + (max_prefixlen > ifam->ifa_prefixlen)) preflen = max_prefixlen; else preflen = ifam->ifa_prefixlen;