From 2c6b25f01802808b142d450af3352605720899da Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 2 Jul 2013 10:46:10 +0200 Subject: 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 --- libmount/src/fs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libmount/src/fs.c') diff --git a/libmount/src/fs.c b/libmount/src/fs.c index c95cdc7e7..75e3bbb26 100644 --- a/libmount/src/fs.c +++ b/libmount/src/fs.c @@ -318,9 +318,12 @@ int __mnt_fs_set_source_ptr(struct libmnt_fs *fs, char *source) assert(fs); - if (source && *source != '/' && strchr(source, '=')) { - if (blkid_parse_tag_string(source, &t, &v) != 0) - return -1; + if (source && blkid_parse_tag_string(source, &t, &v) == 0 && + !mnt_valid_tagname(t)) { + /* parsable but unknown tag -- ignore */ + free(t); + free(v); + t = v = NULL; } if (fs->source != source) -- cgit v1.2.3-55-g7522