Commit 3d9d45c4 authored by Michael Smith's avatar Michael Smith
Browse files

Another fix: the length of the _string_ is not the same as the metadata length

(the metadata is null-padded out to a multiple of 16 bytes), so we have to deal
with that.

svn path=/trunk/icecast/; revision=5817
parent 6128c063
......@@ -326,12 +326,21 @@ static int format_mp3_get_buffer(format_plugin_t *self, char *data,
StreamTitle=' and the closing '; (but only if there's
enough data for it to be correctly formatted) */
if(state->metadata_length >= 15) {
/* This is overly complex because the
metadata_length is the length of the actual raw
data, but the (null-terminated) string is going
to be shorter than this, and we can't trust that
the raw data doesn't have other embedded-nulls */
int stringlength;
state->metadata = malloc(state->metadata_length -
15 + 1);
state->metadata_buffer + 13,
state->metadata_length - 15);
state->metadata[state->metadata_length - 15] = 0;
stringlength = strlen(state->metadata);
if(stringlength > 2)
state->metadata[stringlength - 2] = 0;
Supports Markdown
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