From patchwork Mon Oct 19 09:50:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 532211 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 9CE421402B0 for ; Mon, 19 Oct 2015 20:50:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=Y9XlX14q; dkim-atps=neutral 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:cc:subject:date:message-id; q=dns; s= default; b=ONEFlWEKBs/QlEtWwKPUaN9lQKpCN9Se6M54WY1brkUR3C6n/kiy8 JP8v6YkXGjUVqQXgHgzrjW+vZRx1bABv13xinJb4PaFR0D8RDWRQZmXBS3DB5DZh uQ8dljQ/m2wOn0okfKEmlXtuixzDbbu7fj4M+eiSV9NeVTIUxLH3zA= 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:cc:subject:date:message-id; s=default; bh=lWzH6QObFXbAvN4KBBcsI4uAgME=; b=Y9XlX14qMNeKVXbOJmr8wgVWnLAJ 40Dm9S3jn1depJeToayCDP0kyZQsbDWi7gzaSEnF5zE0vPk5qMbdGbzsRv5yg6Ok 74UIIgdfas6e4FIcUOfZVmoGUYMnFQL8MxULqYUQZggOF0kkT7XQhniZ8tuhnZ7N NOx8d9ChElprb6s= Received: (qmail 14029 invoked by alias); 19 Oct 2015 09:50:20 -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 13981 invoked by uid 89); 19 Oct 2015 09:50:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Andreas Schwab Subject: [COMMITTED 2.19] Fix read past end of pattern in fnmatch (bug 18032) Date: Mon, 19 Oct 2015 11:50:11 +0200 Message-Id: <1445248211-1730-1-git-send-email-aurelien@aurel32.net> From: Andreas Schwab (cherry picked from commit 4a28f4d55a6cc33474c0792fe93b5942d81bf185) Conflicts: ChangeLog NEWS --- ChangeLog | 6 ++++++ NEWS | 2 +- posix/fnmatch_loop.c | 5 ++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 815acf0..a4f4e0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-02-26 Andreas Schwab + + [BZ #18032] + * posix/fnmatch_loop.c (FCT): Remove extra increment when skipping + over collating symbol inside a bracket expression. Minor cleanup. + 2014-06-23 Andreas Schwab [BZ #17079] diff --git a/NEWS b/NEWS index ed33f47..c017fa3 100644 --- a/NEWS +++ b/NEWS @@ -11,7 +11,7 @@ Version 2.19.1 15946, 16545, 16574, 16623, 16657, 16695, 16743, 16878, 16882, 16885, 16916, 16932, 16943, 16958, 17048, 17069, 17079, 17137, 17153, 17213, - 17263, 17325, 17555, 18287. + 17263, 17325, 17555, 18032, 18287. * A buffer overflow in gethostbyname_r and related functions performing DNS requests has been fixed. If the NSS functions were called with a diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c index f79d051..f11d0f1 100644 --- a/posix/fnmatch_loop.c +++ b/posix/fnmatch_loop.c @@ -951,14 +951,13 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) } else if (c == L('[') && *p == L('.')) { - ++p; while (1) { c = *++p; - if (c == '\0') + if (c == L('\0')) return FNM_NOMATCH; - if (*p == L('.') && p[1] == L(']')) + if (c == L('.') && p[1] == L(']')) break; } p += 2;