pulse-server: terminate connection in more cases

If any of those two branches are taken, the connection
cannot make forward progress since no data will be read/sent
from/to the client.

For example, sending just 21 invalid bytes to the server
causes the first 20 bytes (client descriptor) to be read,
then rejected, leaving `client->message == NULL`. But since
polling is level triggered, `on_client_data()` and thus
`do_read()` will continue to be called ceaselessly,
thereby spamming the log and wasting resources.
This commit is contained in:
Barnabás Pőcze 2021-05-31 20:33:34 +02:00
parent bc6adbe15d
commit 1cb613ee4b

View file

@ -5523,7 +5523,7 @@ static int do_read(struct client *client)
uint32_t idx = client->in_index - sizeof(client->desc);
if (client->message == NULL) {
res = -EIO;
res = -EPROTO;
goto exit;
}
data = SPA_PTROFF(client->message->data, idx, void);
@ -5551,7 +5551,7 @@ static int do_read(struct client *client)
flags = ntohl(client->desc.flags);
if ((flags & FLAG_SHMMASK) != 0) {
res = -ENOTSUP;
res = -EPROTO;
goto exit;
}