public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17273] New: getmntent() returns wrong default value for fs_passno
@ 2014-08-15  3:52 naszar at ya dot ru
  2014-08-15  3:53 ` [Bug libc/17273] " naszar at ya dot ru
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: naszar at ya dot ru @ 2014-08-15  3:52 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-08-29 22:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-15  3:52 [Bug libc/17273] New: getmntent() returns wrong default value for fs_passno naszar at ya dot ru
2014-08-15  3:53 ` [Bug libc/17273] " naszar at ya dot ru
2014-08-15  3:54 ` naszar at ya dot ru
2015-08-28 20:34 ` vapier at gentoo dot org
2015-08-28 20:36 ` vapier at gentoo dot org
2015-08-29 22:11 ` cvs-commit at gcc dot gnu.org
2015-08-29 22:13 ` cvs-commit at gcc dot gnu.org
2015-08-29 22:16 ` cvs-commit at gcc dot gnu.org
2015-08-29 22:20 ` cvs-commit at gcc dot gnu.org
2015-08-29 22:21 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).