shithub: opus

Download patch

ref: c280e0435adc7629cfcc5c8316c156807b2e180f
parent: 3e65d1e41ee13676cf38d7ba0f96313e7ca1489e
author: Conrad Parker <[email protected]>
date: Wed Feb 13 08:22:19 EST 2008

off-by-one fix as reported by ogg.k.ogg.k and recently committed in
liboggz and oggenc

--- a/tools/skeleton.c
+++ b/tools/skeleton.c
@@ -28,9 +28,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,