diff options
author | Karel Zak | 2013-05-30 13:29:34 +0200 |
---|---|---|
committer | Karel Zak | 2013-05-30 13:29:34 +0200 |
commit | 8225bb78a631d032121f9d7eed19481220933c88 (patch) | |
tree | 38b2f12002f57bac819e61c7b7c7415d22ad2734 /libmount/src/optstr.c | |
parent | su: ignore --preserve-environment, it's mutually exclusive to --login (diff) | |
download | kernel-qcow2-util-linux-8225bb78a631d032121f9d7eed19481220933c88.tar.gz kernel-qcow2-util-linux-8225bb78a631d032121f9d7eed19481220933c88.tar.xz kernel-qcow2-util-linux-8225bb78a631d032121f9d7eed19481220933c88.zip |
libmount: more robust options string parsing
# mount -o=rw /dev/sdb /mnt/test
mount: libmount/src/optmap.c:212: mnt_optmap_get_entry: Assertion `namelen' failed.
Aborted (core dumped)
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=968786
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/optstr.c')
-rw-r--r-- | libmount/src/optstr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c index 5e9e70807..3c680ff6e 100644 --- a/libmount/src/optstr.c +++ b/libmount/src/optstr.c @@ -77,7 +77,7 @@ static int mnt_optstr_parse_next(char **optstr, char **name, size_t *namesz, open_quote ^= 1; /* reverse the status */ if (open_quote) continue; /* still in quoted block */ - if (!sep && *p == '=') + if (!sep && p > start && *p == '=') sep = p; /* name and value separator */ if (*p == ',') stop = p; /* terminate the option item */ @@ -540,7 +540,7 @@ int mnt_split_optstr(const char *optstr, char **user, char **vfs, if (user) *user = NULL; - while(!mnt_optstr_next_option(&str, &name, &namesz, &val, &valsz)) { + while (!mnt_optstr_next_option(&str, &name, &namesz, &val, &valsz)) { int rc = 0; const struct libmnt_optmap *ent = NULL; const struct libmnt_optmap *m = |