]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: check the unit type more thoroughly when deserializing
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 4 May 2023 14:56:28 +0000 (16:56 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 5 May 2023 20:15:23 +0000 (22:15 +0200)
Resolves: #27523

src/core/unit.c
test/fuzz/fuzz-manager-serialize/clusterfuzz-testcase-minimized-fuzz-manager-serialize-6207619447259136.fuzz [new file with mode: 0644]

index c7635a291c5d9a2f7858f8ce7ead4dee688ac2ea..4e9ae6148f396b08c4f137475cdfdd8b34d4e524 100644 (file)
@@ -6162,7 +6162,9 @@ int activation_details_deserialize(const char *key, const char *value, Activatio
                         return -EINVAL;
 
                 t = unit_type_from_string(value);
-                if (t == _UNIT_TYPE_INVALID)
+                /* The activation details vtable has defined ops only for path
+                 * and timer units */
+                if (!IN_SET(t, UNIT_PATH, UNIT_TIMER))
                         return -EINVAL;
 
                 *details = malloc0(activation_details_vtable[t]->object_size);
diff --git a/test/fuzz/fuzz-manager-serialize/clusterfuzz-testcase-minimized-fuzz-manager-serialize-6207619447259136.fuzz b/test/fuzz/fuzz-manager-serialize/clusterfuzz-testcase-minimized-fuzz-manager-serialize-6207619447259136.fuzz
new file mode 100644 (file)
index 0000000..b3f5c9b
--- /dev/null
@@ -0,0 +1,4 @@
+
+d.socket
+job
+activation-details-unit-type=service
\ No newline at end of file