You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return-EINVAL; /* Every second one needs to be a string, as it is the key name */
The statement in the comment is wrong. The D-Bus spec says this:
A DICT_ENTRY works exactly like a struct, but rather than parentheses it uses curly braces, and it has more restrictions. The restrictions are: it occurs only as an array element type; it has exactly two single complete types inside the curly braces; the first single complete type (the "key") must be a basic type rather than a container type. Implementations must not accept dict entries outside of arrays, must not accept dict entries with zero, one, or more than two fields, and must not accept dict entries with non-basic-typed keys. A dict entry is always a key-value pair.
That is, the first element in a dict entry must be a basic type, which is less strict than just a string. So our JSON code trips over when parsing this part of the aforementioned dbus message:
Came across this in
busctl
while debugging something dbus-broker related.The dbus-broker's
org.freedesktop.DBus.Debug.Stats
interface implementsGetStats
method, which yields following hierarchy:dbus-send ...
However,
busctl
really struggles with this, and straight up refuses to convert it to JSON:After some spelunking, the issue seems to be in this code:
systemd/src/shared/json.c
Lines 738 to 739 in 3acc318
The statement in the comment is wrong. The D-Bus spec says this:
That is, the first element in a dict entry must be a basic type, which is less strict than just a string. So our JSON code trips over when parsing this part of the aforementioned dbus message:
Since the first element in the outermost dict entry is not a string, but an unsigned integer.
The text was updated successfully, but these errors were encountered: