public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "naszar at ya dot ru" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-17273-131@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-08-15  3:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-15  3:52 naszar at ya dot ru [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-17273-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).