diff options
author | Karel Zak | 2013-07-02 10:46:10 +0200 |
---|---|---|
committer | Karel Zak | 2013-07-02 10:46:10 +0200 |
commit | 2c6b25f01802808b142d450af3352605720899da (patch) | |
tree | 560ff39da7ebe2bd9d97549d175960f2ea33e9dc /libmount/src/tab.c | |
parent | lib/canonical: use realpath() from libc (diff) | |
download | kernel-qcow2-util-linux-2c6b25f01802808b142d450af3352605720899da.tar.gz kernel-qcow2-util-linux-2c6b25f01802808b142d450af3352605720899da.tar.xz kernel-qcow2-util-linux-2c6b25f01802808b142d450af3352605720899da.zip |
libmount: be more restrictive about valid tag names
# mount DUMMY=filename.img /mnt
The 'DUMMY=filename.img' is a filename and should not be
interpreted as tag name. The valid tag names are LABEL, UUID,
PARTLABEL and PARTUUID only.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab.c')
-rw-r--r-- | libmount/src/tab.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/libmount/src/tab.c b/libmount/src/tab.c index ef86627f8..b3e47bd6e 100644 --- a/libmount/src/tab.c +++ b/libmount/src/tab.c @@ -716,7 +716,8 @@ struct libmnt_fs *mnt_table_find_tag(struct libmnt_table *tb, const char *tag, struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb, const char *source, int direction) { - struct libmnt_fs *fs = NULL; + struct libmnt_fs *fs; + char *t = NULL, *v = NULL; assert(tb); @@ -727,18 +728,13 @@ struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb, DBG(TAB, mnt_debug_h(tb, "lookup SOURCE: '%s'", source)); - if (source && *source && strchr(source, '=')) { - char *tag, *val; - - if (blkid_parse_tag_string(source, &tag, &val) == 0) { - - fs = mnt_table_find_tag(tb, tag, val, direction); - - free(tag); - free(val); - } - } else + if (blkid_parse_tag_string(source, &t, &v) || !mnt_valid_tagname(t)) fs = mnt_table_find_srcpath(tb, source, direction); + else + fs = mnt_table_find_tag(tb, t, v, direction); + + free(t); + free(v); return fs; } |