From 085f8d61aa1bd7caa0626ef06b0a53100edb79e7 Mon Sep 17 00:00:00 2001 From: brendan Date: Sun, 11 Jul 2004 16:46:02 +0000 Subject: [PATCH] The inline metadata text was losing the final character when the string length was a multiple of 16. svn path=/icecast/trunk/icecast/; revision=7089 --- src/format_mp3.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/format_mp3.c b/src/format_mp3.c index 23c05291..76d6b1bf 100644 --- a/src/format_mp3.c +++ b/src/format_mp3.c @@ -125,28 +125,28 @@ static int send_metadata(client_t *client, mp3_client_data *client_state, fullmetadata_size = strlen (source_state->metadata) + sizeof (meta_fmt); - if (fullmetadata_size > 4080) + if (fullmetadata_size > 4079) { - fullmetadata_size = 4080; + fullmetadata_size = 4079; } fullmetadata = malloc (fullmetadata_size); if (fullmetadata == NULL) break; fullmetadata_size = snprintf (fullmetadata, fullmetadata_size, - "StreamTitle='%.*s';", fullmetadata_size-(sizeof (meta_fmt)-1), source_state->metadata); + "StreamTitle='%.*s';", fullmetadata_size-(sizeof (meta_fmt)-1), source_state->metadata); source_age = source_state->metadata_age; if (fullmetadata_size > 0 && source_age != client_state->metadata_age) { - len_byte = (fullmetadata_size-1)/16 + 1; /* to give 1-255 */ + len_byte = (fullmetadata_size)/16 + 1; /* to give 1-255 */ client_state->metadata_offset = 0; } else len_byte = 0; len = 1 + len_byte*16; - buf = malloc (len); + buf = calloc (1, len); if (buf == NULL) break;