pulse-server: return length of TAG_ARBITRARY

So that we don't have to know the length beforehand but can still
check it.
This commit is contained in:
Wim Taymans 2020-11-03 12:14:09 +01:00
parent bc46ead017
commit bba24b9ff8
2 changed files with 12 additions and 9 deletions

View file

@ -449,15 +449,18 @@ static int do_command_auth(struct client *client, uint32_t command, uint32_t tag
struct message *reply;
uint32_t version;
const void *cookie;
size_t len;
if (message_get(m,
TAG_U32, &version,
TAG_ARBITRARY, &cookie, NATIVE_COOKIE_LENGTH,
TAG_ARBITRARY, &cookie, &len,
TAG_INVALID) < 0) {
return -EPROTO;
}
if (version < 8)
return -EPROTO;
if (len != NATIVE_COOKIE_LENGTH)
return -EINVAL;
if ((version & PROTOCOL_VERSION_MASK) >= 13)
version &= PROTOCOL_VERSION_MASK;