[xiph-cvs] cvs commit: icecast/src format_mp3.c

Michael Smith msmith at xiph.org
Mon Feb 9 20:37:39 PST 2004



msmith      04/02/09 23:37:39

  Modified:    src      format_mp3.c
  Log:
  I Hate String Handling In C.

Revision  Changes    Path
1.32      +7 -2      icecast/src/format_mp3.c

Index: format_mp3.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format_mp3.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- format_mp3.c	10 Feb 2004 04:29:54 -0000	1.31
+++ format_mp3.c	10 Feb 2004 04:37:30 -0000	1.32
@@ -334,10 +334,15 @@
                             int stringlength;
                             
                             state->metadata = malloc(state->metadata_length -
-                                    15 + 1);
+                                    12);
                             memcpy(state->metadata, 
                                     state->metadata_buffer + 13, 
-                                    state->metadata_length - 15);
+                                    state->metadata_length - 13);
+                            /* Make sure we've got a null-terminator of some
+                               sort */
+                            state->metadata[state->metadata_length - 13] = 0;
+
+                            /* Now figure out the _right_ one */
                             stringlength = strlen(state->metadata);
                             if(stringlength > 2)
                                 state->metadata[stringlength - 2] = 0;

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list