From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1845 invoked by alias); 24 Mar 2013 17:22:16 -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 1809 invoked by uid 48); 24 Mar 2013 17:22:07 -0000 From: "repentinus at fsfe dot org" To: glibc-bugs@sourceware.org Subject: [Bug stdio/15301] New: scanf family misbehaves on %m when zero characters are read Date: Sun, 24 Mar 2013 17:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: repentinus at fsfe dot org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2013-03/txt/msg00111.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=3D15301 Bug #: 15301 Summary: scanf family misbehaves on %m when zero characters are read Product: glibc Version: 2.17 Status: NEW Severity: normal Priority: P2 Component: stdio AssignedTo: unassigned@sourceware.org ReportedBy: repentinus@fsfe.org Classification: Unclassified Demonstration at (11 lines). After the sscanf ca= ll b should point to otherwise empty null-terminated string (e.g., ""). However,= as can be seen from the example, b becomes a null pointer. The POSIX specification states: "The %c , %s , and %[ conversion specifiers shall accept an optional assignment-allocation character 'm' , which shall cause a memory buffer to be allocated to hold the string converted includin= g a terminating null character. [=E2=80=A6] The system shall allocate a buffer = as if malloc() had been called. [=E2=80=A6] If there is insufficient memory to al= locate a buffer, the function shall set errno to [ENOMEM] and a conversion error sha= ll result. If the function returns EOF, any memory successfully allocated for parameters using assignment-allocation character 'm' by this call shall be freed before the function returns." In the example case there is neither insufficient memory nor is EOF returne= d. Thus, b should point to "", and should not be null. --=20 Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=3Demail ------- You are receiving this mail because: ------- You are on the CC list for the bug. >>From glibc-bugs-return-18213-listarch-glibc-bugs=sources.redhat.com@sourceware.org Sun Mar 24 17:35:04 2013 Return-Path: Delivered-To: listarch-glibc-bugs@sources.redhat.com Received: (qmail 4884 invoked by alias); 24 Mar 2013 17:35:04 -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 Delivered-To: mailing list glibc-bugs@sourceware.org Received: (qmail 4791 invoked by uid 48); 24 Mar 2013 17:34:56 -0000 From: "repentinus at fsfe dot org" To: glibc-bugs@sourceware.org Subject: [Bug stdio/15301] scanf family misbehaves on %m when zero characters are read Date: Sun, 24 Mar 2013 17:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: repentinus at fsfe dot org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-03/txt/msg00112.txt.bz2 Content-length: 466 http://sourceware.org/bugzilla/show_bug.cgi?id=15301 --- Comment #1 from Heiki Ojasild 2013-03-24 17:34:56 UTC --- Created attachment 6945 --> http://sourceware.org/bugzilla/attachment.cgi?id=6945 Testcase demonstrating the problem (identical to the one on IdeOne) -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.