summaryrefslogtreecommitdiffstats
path: root/libmount/src/utils.c
diff options
context:
space:
mode:
authorKarel Zak2013-07-02 10:46:10 +0200
committerKarel Zak2013-07-02 10:46:10 +0200
commit2c6b25f01802808b142d450af3352605720899da (patch)
tree560ff39da7ebe2bd9d97549d175960f2ea33e9dc /libmount/src/utils.c
parentlib/canonical: use realpath() from libc (diff)
downloadkernel-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/utils.c')
-rw-r--r--libmount/src/utils.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index c328414f2..6c5171eca 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -65,6 +65,18 @@ int is_file_empty(const char *name)
return (stat(name, &st) != 0 || st.st_size == 0);
}
+int mnt_valid_tagname(const char *tagname)
+{
+ if (tagname && *tagname && (
+ strcmp("UUID", tagname) == 0 ||
+ strcmp("LABEL", tagname) == 0 ||
+ strcmp("PARTUUID", tagname) == 0 ||
+ strcmp("PARTLABEL", tagname) == 0))
+ return 1;
+
+ return 0;
+}
+
int mnt_parse_offset(const char *str, size_t len, uintmax_t *res)
{
char *p;