This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] [BZ 17273] fix incorrect mount table entry parsing in __getmntent_r()
- From: "Vladimir A. Nazarenko" <naszar at ya dot ru>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: "GNU C. Library" <libc-alpha at sourceware dot org>, "Vladimir A. Nazarenko" <naszar at ya dot ru>
- Date: Sat, 30 Aug 2014 15:06:52 +1100
- Subject: Re: [PATCH] [BZ 17273] fix incorrect mount table entry parsing in __getmntent_r()
- Authentication-results: sourceware.org; auth=none
- Authentication-results: smtp2h.mail.yandex.net; dkim=pass header dot i= at ya dot ru
- References: <1409319124-31716-1-git-send-email-naszar at ya dot ru> <20140829215816 dot D05202C3A30 at topped-with-meat dot com>
On 30.08.2014 08:58, Roland McGrath wrote:
> Please write a test case.
>
Can I modify existing test or I must create new one? Is following patch OK?
Can I resend fixed patch and test case as *one* patch?
>
> This should look like:
>
how about that:
[BZ #17273]
* misc/mntent_r.c (__getmntent_r): cut off trailing spaces
and tabs from bufer before parsing fstab entry.
* misc/tst-mntent.c(main): add test for mount entry with
trailing spaces and tabs.
---
diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
index 802b56e..f568ba8 100644
--- a/misc/tst-mntent.c
+++ b/misc/tst-mntent.c
@@ -73,7 +73,21 @@ main (int argc, char *argv[])
puts ("Error while reading written entry back in");
result = 1;
}
- }
+
+ /*part III: test if entry with trailing whitespaces*/
+ fputs("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
+
+ rewind (fp);
+
+ mnt = getmntent(fp);
+ mnt = getmntent(fp);
+ if (mnt->mnt_freq != 0 || mnt->mnt_passno != 0)
+ {
+ printf("Error mnt_freq = %d and mnt_opts = %d, but zero expected\n",
+ mnt->mnt_freq, mnt->mnt_passno);
+ result = 1;
+ }
+ }
return result;
}