]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: execute: validate syslog level and facility 1528/head
authorEvgeny Vereshchagin <evvers@ya.ru>
Wed, 14 Oct 2015 16:30:35 +0000 (16:30 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Wed, 14 Oct 2015 16:35:30 +0000 (16:35 +0000)
src/core/dbus-execute.c

index b87192a9aebe25c2231b924c40ed19dbc4ce38be..8b1f830476dd98ba58044ffa3f74435f27da42c7 100644 (file)
@@ -888,6 +888,9 @@ int bus_exec_context_set_transient_property(
                 if (r < 0)
                         return r;
 
+                if (!log_level_is_valid(level))
+                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Log level value out of range");
+
                 if (mode != UNIT_CHECK) {
                         c->syslog_priority = (c->syslog_priority & LOG_FACMASK) | level;
                         unit_write_drop_in_private_format(u, mode, name, "SyslogLevel=%i\n", level);
@@ -901,6 +904,9 @@ int bus_exec_context_set_transient_property(
                 if (r < 0)
                         return r;
 
+                if (!log_facility_unshifted_is_valid(facility))
+                        return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Log facility value out of range");
+
                 if (mode != UNIT_CHECK) {
                         c->syslog_priority = (facility << 3) | LOG_PRI(c->syslog_priority);
                         unit_write_drop_in_private_format(u, mode, name, "SyslogFacility=%i\n", facility);