bus-message: validate signature in gvariant messages

We would accept a message with 40k signature and spend a lot of time iterating
over the nested arrays. Let's just reject it early, as we do for !gvariant
messages.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-04-11 14:01:38 +02:00
parent 4ddff52640
commit f0ae945ecc
2 changed files with 4 additions and 1 deletions

View File

@ -5152,7 +5152,7 @@ int bus_message_parse_fields(sd_bus_message *m) {
return -EBADMSG;
if (*p == 0) {
char *k;
_cleanup_free_ char *k = NULL;
size_t l;
/* We found the beginning of the signature
@ -5170,6 +5170,9 @@ int bus_message_parse_fields(sd_bus_message *m) {
if (!k)
return -ENOMEM;
if (!signature_is_valid(k, true))
return -EBADMSG;
free_and_replace(m->root_container.signature, k);
break;
}

Binary file not shown.