[xiph-commits] r3386 - liboggz/trunk/src/liboggz

conrad at svn.annodex.net conrad at svn.annodex.net
Fri Jan 25 19:29:26 PST 2008


Author: conrad
Date: 2008-01-25 19:29:24 -0800 (Fri, 25 Jan 2008)
New Revision: 3386

Modified:
   liboggz/trunk/src/liboggz/oggz_comments.c
Log:
don't bomb out on empty vendor string


Modified: liboggz/trunk/src/liboggz/oggz_comments.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_comments.c	2008-01-25 06:48:00 UTC (rev 3385)
+++ liboggz/trunk/src/liboggz/oggz_comments.c	2008-01-26 03:29:24 UTC (rev 3386)
@@ -619,14 +619,15 @@
   oggz_stream_t * stream;
   char * c = (char *)buf;
   const OggzComment * comment;
-  int nb_fields = 0, vendor_length, field_length;
+  int nb_fields = 0, vendor_length = 0, field_length;
   long actual_length, remaining = length;
 
   stream = oggz_get_stream (oggz, serialno);
   if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
 
   /* Vendor string */
-  vendor_length = strlen (stream->vendor);
+  if (stream->vendor)
+    vendor_length = strlen (stream->vendor);
   actual_length = 4 + vendor_length;
 #ifdef DEBUG
   printf ("oggz_comments_encode: vendor = %s\n", stream->vendor);
@@ -658,10 +659,12 @@
   writeint (c, 0, vendor_length);
   c += 4;
 
-  field_length = strlen (stream->vendor);
-  memcpy (c, stream->vendor, MIN (field_length, remaining));
-  c += field_length; remaining -= field_length;
-  if (remaining <= 0 ) return actual_length;
+  if (stream->vendor) {
+    field_length = strlen (stream->vendor);
+    memcpy (c, stream->vendor, MIN (field_length, remaining));
+    c += field_length; remaining -= field_length;
+    if (remaining <= 0 ) return actual_length;
+  }
 
   remaining -= 4;
   if (remaining <= 0) return actual_length;



More information about the commits mailing list