Commit 16dac250 authored by Marvin Scholz's avatar Marvin Scholz

Fix that global listener count could be negative under certain circumstances

This fixes a bug that could cause the global listener count of Icecast to
be negative. This was caused due to wrong handling of errors in the
format_prepare_headers function.

Fixes: #2199

Thanks a lot to Simeon Völkel (0xBD4E031CDB4043C9) for reporting
and investigating the bug.
parent c35760cd
......@@ -408,8 +408,12 @@ static int format_prepare_headers (source_t *source, client_t *client)
client->refbuf->len -= remaining;
if (source->format->create_client_data)
if (source->format->create_client_data (source, client) < 0)
if (source->format->create_client_data (source, client) < 0) {
ICECAST_LOG_ERROR("Client format header generation failed. "
"(Likely not enough or wrong source data) Dropping client.");
client->respcode = 500;
return -1;
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment