varlink: refuse empty () structs/enums

If we encounter an empty struct in the varlink IDL it could also be an
empty enum. Refuse this to avoid the ambiguity.

The spec doesn't cover this case clearly, hence let's better be on the
safe side and refuse it rather than making a decision what it means.
This commit is contained in:
Lennart Poettering
2023-10-12 15:25:16 +02:00
parent 558dc668f6
commit 6fa09278b8
+5
View File
@@ -828,6 +828,11 @@ static int varlink_idl_subparse_struct_or_enum(
}
}
/* If we don't know the type of the symbol by now it was an empty () which doesn't allow us to
* determine if we look at an enum or a struct */
if ((*symbol)->symbol_type < 0)
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "%u:%u: Ambiguous empty () enum/struct is not permitted.", *line, *column);
return 0;
}