[xiph-commits] r14485 - trunk/vorbis-tools/oggenc

conrad at svn.xiph.org conrad at svn.xiph.org
Tue Feb 12 01:41:03 PST 2008


Author: conrad
Date: 2008-02-12 01:41:02 -0800 (Tue, 12 Feb 2008)
New Revision: 14485

Modified:
   trunk/vorbis-tools/oggenc/skeleton.c
Log:
oggenc/skeleton.c: add_message_header_field() off-by-one fix, from patch by
ogg.k.ogg.k.
This now uses a working buffer one char longer than necessary for filling
the message header fields, as snprintf was replacing the final LF with NUL.
However, the final NUL is not copied into the generated fisbone packet.


Modified: trunk/vorbis-tools/oggenc/skeleton.c
===================================================================
--- trunk/vorbis-tools/oggenc/skeleton.c	2008-02-12 07:56:48 UTC (rev 14484)
+++ trunk/vorbis-tools/oggenc/skeleton.c	2008-02-12 09:41:02 UTC (rev 14485)
@@ -86,9 +86,9 @@
     /* size of both key and value + ': ' + CRLF */
     int this_message_size = strlen(header_key) + strlen(header_value) + 4;
     if (fp->message_header_fields == NULL) {
-        fp->message_header_fields = _ogg_calloc(this_message_size, sizeof(char));
+        fp->message_header_fields = _ogg_calloc(this_message_size+1, sizeof(char));
     } else {
-        int new_size = (fp->current_header_size + this_message_size) * sizeof(char);
+        int new_size = (fp->current_header_size + this_message_size+1) * sizeof(char);
         fp->message_header_fields = _ogg_realloc(fp->message_header_fields, new_size);
     }
     snprintf(fp->message_header_fields + fp->current_header_size, 



More information about the commits mailing list