summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-05-06 14:27:02 +0900
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-05-08 09:49:55 +0200
commit210cb8d690cf585b7cd162efbdc563a5ae6921ff (patch)
tree5558c62993627178c17ad3cfdcddd84e40559a27 /src/core
parentd2132d3d8d68e4f5dbe935c8af7a50eb124bcb8e (diff)
downloadsystemd-210cb8d690cf585b7cd162efbdc563a5ae6921ff.tar.gz
core/unit: check the validity of unit type with activation_details_vtable
Follow-up for 24e91e08f8958241195f97472353adef94884b33.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/unit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 4e9ae6148f..d275adb9b0 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -6162,9 +6162,11 @@ int activation_details_deserialize(const char *key, const char *value, Activatio
return -EINVAL;
t = unit_type_from_string(value);
- /* The activation details vtable has defined ops only for path
- * and timer units */
- if (!IN_SET(t, UNIT_PATH, UNIT_TIMER))
+ if (t < 0)
+ return t;
+
+ /* The activation details vtable has defined ops only for path and timer units */
+ if (!activation_details_vtable[t])
return -EINVAL;
*details = malloc0(activation_details_vtable[t]->object_size);