mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 07:05:57 -05:00
[outputs] Fix segv due to incorrect array size (fix for issue #866)
If the number of quality subscriptions reaches max then this bug will be triggered, because we will incorrectly use the last element of the output_buffer for a subscription, thus losing the zero terminator.
This commit is contained in:
parent
33f97f55f3
commit
0c08e83811
@ -313,7 +313,6 @@ buffer_fill(struct output_buffer *obuf, void *buf, size_t bufsize, struct media_
|
||||
int i;
|
||||
int n;
|
||||
|
||||
obuf->write_counter++;
|
||||
obuf->pts = *pts;
|
||||
|
||||
// The resampling/encoding (transcode) contexts work for a given input quality,
|
||||
|
@ -187,9 +187,11 @@ struct output_data
|
||||
|
||||
struct output_buffer
|
||||
{
|
||||
uint32_t write_counter; // REMOVE ME? not used for anything
|
||||
struct timespec pts;
|
||||
struct output_data data[OUTPUTS_MAX_QUALITY_SUBSCRIPTIONS + 1];
|
||||
// The array is two larger than max quality subscriptions because element 0
|
||||
// holds the original, untranscoded, data (which might not have any
|
||||
// subscribers, and the last element is a zero terminator.
|
||||
struct output_data data[OUTPUTS_MAX_QUALITY_SUBSCRIPTIONS + 2];
|
||||
} output_buffer;
|
||||
|
||||
struct output_definition
|
||||
|
Loading…
Reference in New Issue
Block a user