1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05:00

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.
This commit is contained in:
Marvin Scholz 2015-06-06 14:06:48 +02:00 committed by Philipp Schafft
parent 72f0c83540
commit 4053321b0c

View File

@ -405,8 +405,12 @@ static int format_prepare_headers (source_t *source, client_t *client)
client->refbuf->len -= remaining; client->refbuf->len -= remaining;
if (source->format->create_client_data) 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 -1;
}
return 0; return 0;
} }