summaryrefslogtreecommitdiff
path: root/src/hostname
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/hostname
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/hostname')
-rw-r--r--src/hostname/hostnamed.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 970e800769..ef45e563c8 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -552,7 +552,7 @@ static int set_machine_info(Context *c, sd_bus *bus, sd_bus_message *m, int prop
/* The icon name might ultimately be used as file
* name, so better be safe than sorry */
- if (prop == PROP_ICON_NAME && !filename_is_safe(name))
+ if (prop == PROP_ICON_NAME && !filename_is_valid(name))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid icon name '%s'", name);
if (prop == PROP_PRETTY_HOSTNAME && string_has_cc(name, NULL))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid pretty host name '%s'", name);