From: Yu Watanabe Date: Sat, 6 May 2023 05:27:02 +0000 (+0900) Subject: core/unit: check the validity of unit type with activation_details_vtable X-Git-Tag: v254-rc1~542 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=210cb8d690cf585b7cd162efbdc563a5ae6921ff;p=thirdparty%2Fsystemd.git core/unit: check the validity of unit type with activation_details_vtable Follow-up for 24e91e08f8958241195f97472353adef94884b33. --- diff --git a/src/core/unit.c b/src/core/unit.c index 4e9ae6148f3..d275adb9b0f 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);