From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47179 invoked by alias); 26 Feb 2015 18:12:28 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 47133 invoked by uid 48); 26 Feb 2015 18:12:20 -0000 From: "konstantin.s.serebryany at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/18036] New: buffer overflow (read past end of buffer) in internal_fnmatch=>end_pattern with "**(!()" pattern Date: Thu, 26 Feb 2015 18:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.21 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: konstantin.s.serebryany at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security+ X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg00403.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=18036 Bug ID: 18036 Summary: buffer overflow (read past end of buffer) in internal_fnmatch=>end_pattern with "**(!()" pattern Product: glibc Version: 2.21 Status: NEW Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: konstantin.s.serebryany at gmail dot com CC: drepper.fsp at gmail dot com Flags: security+ Similar to https://sourceware.org/bugzilla/show_bug.cgi?id=18032 but in a different place: #include #include #include #include #include #include #include int main(int argc, const char* argv[]) { long page_size = sysconf (_SC_PAGESIZE); assert(page_size > 0); char *page = mmap (NULL, 2 * page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); assert(page != MAP_FAILED); assert(!mprotect (page + page_size, page_size, PROT_NONE)); memset (page, ' ', page_size); const char p[] = "**(!()"; strcpy(page, p); fnmatch(page, p, FNM_EXTMATCH); } gcc fn3.c && ./a.out Segmentation fault (core dumped) gdb: (gdb) bt #0 0x00007ffff7adaf4b in end_pattern (pattern=pattern@entry=0x7ffff7ff6002 "(!()") at fnmatch_loop.c:1032 #1 0x00007ffff7adcbb9 in internal_fnmatch (pattern=, string=string@entry=0x7fffffffdcd0 "**(!()", string_end=0x7fffffffdcd6 "", no_leading_period=no_leading_period@entry=0, flags=flags@entry=32, ends=ends@entry=0x0, alloca_used=alloca_used@entry=0) at fnmatch_loop.c:128 #2 0x00007ffff7addf72 in __fnmatch (pattern=0x7ffff7ff6000 "**(!()", string=0x7fffffffdcd0 "**(!()", flags=32) at fnmatch.c:458 #3 0x000000000040084a in main () Reproduces on 2.19 and fresh trunk. Marking as security+ similar to bug 18032 Since bug 18032 has been fixed promptly I assume you don't mind these reports. -- You are receiving this mail because: You are on the CC list for the bug.