off-by-one fix as reported by ogg.k.ogg.k and recently committed in
authorConrad Parker <conrad@metadecks.org>
Wed, 13 Feb 2008 02:22:19 +0000 (13:22 +1100)
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>
Wed, 13 Feb 2008 02:22:19 +0000 (13:22 +1100)
liboggz and oggenc

tools/skeleton.c

index 22159d5..03c3e81 100644 (file)
@@ -28,9 +28,9 @@ int add_message_header_field(fisbone_packet *fp,
     /* 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,