summaryrefslogtreecommitdiff
path: root/src/locale/localed.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-12 02:32:33 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-12 13:35:32 +0100
commitae6c3cc009a21df4b51851fb8fe3fde0b7d6d8f0 (patch)
tree98eda04d3ff6c24177217efbe9613ed6ed2dc51b /src/locale/localed.c
parent8d1c8bd746a6a14dec7470f93f843bcb0699f4b8 (diff)
util: when using basename() for creating temporary files, verify the resulting name is actually valid
Also, rename filename_is_safe() to filename_is_valid(), since it actually does a full validation for what the kernel will accept as file name, it's not just a heuristic.
Diffstat (limited to 'src/locale/localed.c')
-rw-r--r--src/locale/localed.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 8d60d0ff13..0aaa63de85 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -965,8 +965,8 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata
if (!streq_ptr(keymap, c->vc_keymap) ||
!streq_ptr(keymap_toggle, c->vc_keymap_toggle)) {
- if ((keymap && (!filename_is_safe(keymap) || !string_is_safe(keymap))) ||
- (keymap_toggle && (!filename_is_safe(keymap_toggle) || !string_is_safe(keymap_toggle))))
+ if ((keymap && (!filename_is_valid(keymap) || !string_is_safe(keymap))) ||
+ (keymap_toggle && (!filename_is_valid(keymap_toggle) || !string_is_safe(keymap_toggle))))
return sd_bus_error_set_errnof(error, -EINVAL, "Received invalid keymap data");
r = bus_verify_polkit_async(m, CAP_SYS_ADMIN, "org.freedesktop.locale1.set-keyboard", interactive, &c->polkit_registry, error);