From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23147 invoked by alias); 14 Nov 2006 23:46:37 -0000 Received: (qmail 23130 invoked by uid 22791); 14 Nov 2006 23:46:37 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 14 Nov 2006 23:46:31 +0000 Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.1/8.13.1) with ESMTP id kAENk01J010766; Wed, 15 Nov 2006 00:46:00 +0100 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.13.1/8.13.1/Submit) id kAENk0ca010765; Wed, 15 Nov 2006 00:46:00 +0100 Date: Tue, 14 Nov 2006 23:46:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Fix :include: handling in files-alias.c Message-ID: <20061114234559.GD3849@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00010.txt.bz2 Hi! When the inner loop terminates, line is NULL, but later code expects to find the rest of the aliases line (after :include: and it's argument) at line. Also, old_line is certainly != NULL (tested by the surrounding if), so there is no need to test it once more (well, free allows NULL argument anyway). 2006-11-14 Jakub Jelinek * nss/nss_files/files-alias.c (get_next_alias): Set line back to first_unused after parsing :include: file. --- libc/nss/nss_files/files-alias.c.jj 2002-09-01 14:38:05.000000000 +0200 +++ libc/nss/nss_files/files-alias.c 2006-11-14 21:04:20.000000000 +0100 @@ -1,5 +1,5 @@ /* Mail alias file parser in nss_files module. - Copyright (C) 1996,97,98,99,2002 Free Software Foundation, Inc. + Copyright (C) 1996,97,98,99,2002,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -298,8 +298,8 @@ get_next_alias (const char *match, struc first_unused[room_left - 1] = '\0'; strncpy (first_unused, old_line, room_left); - if (old_line != NULL) - free (old_line); + free (old_line); + line = first_unused; if (first_unused[room_left - 1] != '\0') goto no_more_room; Jakub