From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2023 invoked by alias); 15 Aug 2014 03:52:56 -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 1926 invoked by uid 48); 15 Aug 2014 03:52:46 -0000 From: "naszar at ya dot ru" To: glibc-bugs@sourceware.org Subject: [Bug libc/17273] New: getmntent() returns wrong default value for fs_passno Date: Fri, 15 Aug 2014 03:52: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: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: naszar at ya dot ru X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc attachments.created 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: 2014-08/txt/msg00064.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17273 Bug ID: 17273 Summary: getmntent() returns wrong default value for fs_passno Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: naszar at ya dot ru CC: drepper.fsp at gmail dot com Created attachment 7747 --> https://sourceware.org/bugzilla/attachment.cgi?id=7747&action=edit simple test program man 5 fstab states that if the fifth field (fs_freq) and the sixth field (fs_passno) is not present a value of zero is returned (i.q. fs_req=0,fs_passno=0 if there is no fifth and sixth field in /etc/fstab line). If fourth field ends with '\n' all work fine. But if there is extra tabs or spaces getmntent() returns garbage in ((struct mntent *) mp)->mnt_passno. It is because in misc/mntent_r.c:__getmntent_r() at line 167 no checks that sscanf() returns EOF or no striping for spaces and tabs like it done at line 164 for example. In my mashine attached test_mntent (for testtab which also attached) say: mnt_dir=/home mnt_freq=42 mnt_passno=666 mnt_dir=/home mnt_freq=42 mnt_passno=666 but must: mnt_dir=/home mnt_freq=42 mnt_passno=666 mnt_dir=/home mnt_freq=0 mnt_passno=0 -- You are receiving this mail because: You are on the CC list for the bug.