From af068a72a6a9ab74516324ad47eff8f832511497 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Wed, 16 Jan 2013 12:02:14 +0000 Subject: [PATCH] Replaced usage of sprintf() with snprintf(). Also exported size of key printer's buffer in avl/. svn path=/icecast/trunk/avl/; revision=18771 --- src/avl/avl.c | 4 ++-- src/avl/avl.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/avl/avl.c b/src/avl/avl.c index 5f1a8cb8..5653440e 100644 --- a/src/avl/avl.c +++ b/src/avl/avl.c @@ -1074,7 +1074,7 @@ static char balance_chars[3] = {'\\', '-', '/'}; 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 @@ print_node (avl_key_printer_fun_type key_printer, avl_node * node, link_node * link) { - char buffer[256]; + char buffer[AVL_KEY_PRINTER_BUFLEN]; unsigned int width; width = key_printer (buffer, node->key); diff --git a/src/avl/avl.h b/src/avl/avl.h index 6c24badb..3e02ce42 100644 --- a/src/avl/avl.h +++ b/src/avl/avl.h @@ -11,6 +11,8 @@ extern "C" { #endif +#define AVL_KEY_PRINTER_BUFLEN (256) + #ifndef NO_THREAD #include "thread/thread.h" #else