summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-07-07 20:02:41 +0200
committerKay Sievers <kay.sievers@vrfy.org>2011-07-07 20:02:41 +0200
commit705a165d4d7cea43cec11eaaaaf51b16806edf68 (patch)
tree3efd41adeda38a8dbc5946f96f1a84122baf20ea /udev
parent91f329fcd0baafd21ceb178cfbae0235f5abbcb0 (diff)
enforce valid TAG+= names
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-rules.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/udev/udev-rules.c b/udev/udev-rules.c
index 56a258d8ad..d16c1f9454 100644
--- a/udev/udev-rules.c
+++ b/udev/udev-rules.c
@@ -2528,10 +2528,20 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
}
case TK_A_TAG: {
char tag[UTIL_PATH_SIZE];
+ const char *p;
udev_event_apply_format(event, &rules->buf[cur->key.value_off], tag, sizeof(tag));
if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL)
udev_device_cleanup_tags_list(event->dev);
+ for (p = tag; *p != '\0'; p++) {
+ if ((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9') ||
+ *p == '-' || *p == '_')
+ continue;
+ err(event->udev, "ignoring invalid tag name '%s'\n", tag);
+ break;
+ }
udev_device_add_tag(event->dev, tag);
break;
}