[xiph-commits] r18771 - icecast/trunk/avl

ph3-der-loewe at svn.xiph.org ph3-der-loewe at svn.xiph.org
Wed Jan 16 04:02:14 PST 2013


Author: ph3-der-loewe
Date: 2013-01-16 04:02:14 -0800 (Wed, 16 Jan 2013)
New Revision: 18771

Modified:
   icecast/trunk/avl/avl.c
   icecast/trunk/avl/avl.h
Log:
Replaced usage of sprintf() with snprintf(). Also exported size of key printer's buffer in avl/.

Modified: icecast/trunk/avl/avl.c
===================================================================
--- icecast/trunk/avl/avl.c	2013-01-16 00:05:29 UTC (rev 18770)
+++ icecast/trunk/avl/avl.c	2013-01-16 12:02:14 UTC (rev 18771)
@@ -1074,7 +1074,7 @@
 static int
 default_key_printer (char * buffer, void * key)
 {
-  return sprintf (buffer, "%p", key);
+  return snprintf (buffer, AVL_KEY_PRINTER_BUFLEN, "%p", key);
 }  
 
 /*
@@ -1116,7 +1116,7 @@
         avl_node * node,
         link_node * link)
 {
-  char buffer[256];
+  char buffer[AVL_KEY_PRINTER_BUFLEN];
   unsigned int width;
   width = key_printer (buffer, node->key);
 

Modified: icecast/trunk/avl/avl.h
===================================================================
--- icecast/trunk/avl/avl.h	2013-01-16 00:05:29 UTC (rev 18770)
+++ icecast/trunk/avl/avl.h	2013-01-16 12:02:14 UTC (rev 18771)
@@ -11,6 +11,8 @@
 extern "C" {
 #endif
 
+#define AVL_KEY_PRINTER_BUFLEN (256)
+
 #ifndef NO_THREAD
 #include "thread/thread.h"
 #else



More information about the commits mailing list