* [PATCH] libmount/optstr: trim leading commas from each opt
@ 2012-06-03 16:25 Dave Reisner
2012-06-05 13:50 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Dave Reisner @ 2012-06-03 16:25 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
Fixes a bug in option string parsing wherein a line such as:
ro,relatime,,nosuid,nodev
Will be seen as only the tokens "ro" and "relatime" after the parser
encounters a zero length (and erroneously declared NULL) option.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
libmount/src/optstr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
index af5953b..66d2a06 100644
--- a/libmount/src/optstr.c
+++ b/libmount/src/optstr.c
@@ -62,6 +62,11 @@ static int mnt_optstr_parse_next(char **optstr, char **name, size_t *namesz,
if (valsz)
*valsz = 0;
+ /* trim leading commas as to not invalidate option
+ * strings with multiple consecutive commas */
+ while (optstr0 && *optstr0 == ',')
+ optstr0++;
+
for (p = optstr0; p && *p; p++) {
if (!start)
start = p; /* begin of the option item */
--
1.7.10.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-05 13:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-03 16:25 [PATCH] libmount/optstr: trim leading commas from each opt Dave Reisner
2012-06-05 13:50 ` Karel Zak
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 NNTP newsgroup(s).