summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-signature.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-bus/bus-signature.c')
-rw-r--r--src/libsystemd/sd-bus/bus-signature.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-signature.c b/src/libsystemd/sd-bus/bus-signature.c
index 18c91e8707..1ecd6e8b7e 100644
--- a/src/libsystemd/sd-bus/bus-signature.c
+++ b/src/libsystemd/sd-bus/bus-signature.c
@@ -1,6 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
-/***
-***/
#include <util.h>
@@ -58,6 +56,12 @@ static int signature_element_length_internal(
p += t;
}
+ if (p - s < 2)
+ /* D-Bus spec: Empty structures are not allowed; there
+ * must be at least one type code between the parentheses.
+ */
+ return -EINVAL;
+
*l = p - s + 1;
return 0;
}