From patchwork Mon Jun 23 10:00:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 362733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 23D541400AA for ; Mon, 23 Jun 2014 20:01:01 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=n41x0rEnaoM6egjvvOWcCJsa3/59b KH8awC3Ms2xl73gUrC2WIytQsm25NgczEG4cwVhRx1k1iF0Xm4FiFrcWkcG79EFS NbB5CUuSYsfKWeIUQk7iTpCfrBUsj+uD3uZFCkDKIXwpQUI3/TwSZjxRNqTV17ft kNCK9NOafasITs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=JAW+Tff0xFO6pmnRN7Qp+KJalQs=; b=DpK 0GXOKwdYJB+TQhqWKHJURsSEVdfcLf3GDPo8TaWl9p61q0TBVoqd8xr/lTG0A/HP NxzjW5CUtqg44ArCIX1m8C/bdwXofiKRpKBEMylQUUjpBFpqZO2/UpzI9Nl1lccH o4HtGPYRdN9u5xxG7q0WJVwVnPbFGGBYyWuoIf2o= Received: (qmail 5340 invoked by alias); 23 Jun 2014 10:00:55 -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 5303 invoked by uid 89); 23 Jun 2014 10:00:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Don't ignore too long lines in nss_files (BZ #17079) X-Yow: Has everybody got HALVAH spread all over their ANKLES??... Now, it's time to ``HAVE A NAGEELA''!! Date: Mon, 23 Jun 2014 12:00:09 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 This fixes a misplaced line in the patch for bug 16071 which is causing nss_files to ignore lines that are longer than the supplied buffer, instead of returning ERANGE to the caller. Andreas. [BZ #17079] * nss/nss_files/files-XXX.c (get_contents): Store overflow marker before reading the next line. diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c index 00b2ecf..212b938 100644 --- a/nss/nss_files/files-XXX.c +++ b/nss/nss_files/files-XXX.c @@ -198,10 +198,12 @@ get_contents (char *linebuf, size_t len, FILE *stream) { int curlen = ((remaining_len > (size_t) INT_MAX) ? INT_MAX : remaining_len); - char *p = fgets_unlocked (curbuf, curlen, stream); + /* Terminate the line so that we can test for overflow. */ ((unsigned char *) curbuf)[curlen - 1] = 0xff; + char *p = fgets_unlocked (curbuf, curlen, stream); + /* EOF or read error. */ if (p == NULL) return gcr_error;