[MPlayer-cvslog] CVS: main/libaf af_format.c,1.17,1.18

Reimar Döffinger CVS syncmail at mplayerhq.hu
Mon Dec 27 20:47:35 CET 2004


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libaf
In directory mail:/var2/tmp/cvs-serv23453/libaf

Modified Files:
	af_format.c 
Log Message:
ensure af_fmt2str always return a 0 terminated string


Index: af_format.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_format.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- af_format.c	27 Dec 2004 17:30:13 -0000	1.17
+++ af_format.c	27 Dec 2004 19:47:33 -0000	1.18
@@ -110,6 +110,10 @@
 {
   int i=0;
 
+  if (size < 1)
+    return NULL;
+  size--; // reserve one for terminating 0
+
   // Endianess
   if(AF_FORMAT_LE == (format & AF_FORMAT_END_MASK))
     i+=snprintf(str,size-i,"little endian ");
@@ -147,6 +151,7 @@
       i+=snprintf(&str[i],size-i,"int ");
     }
   }
+  str[i] = 0; // make sure it is 0 terminated.
   return str;
 }
 




More information about the MPlayer-cvslog mailing list