more snprintf() from maintainer Moritz Grimm <gtgbr at gmx.net>

This commit is contained in:
sturm 2005-04-18 20:14:34 +00:00
parent 9866011ba0
commit 0eb23bd7b4
3 changed files with 42 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.1.1.1 2005/02/19 20:49:51 alek Exp $
# $OpenBSD: Makefile,v 1.2 2005/04/18 20:14:34 sturm Exp $
COMMENT= "icecast source for streaming Ogg Vorbis"
DISTNAME= ices-2.0.1
PKGNAME= ${DISTNAME}p0
CATEGORIES= net audio
HOMEPAGE= http://www.icecast.org/

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-src_avl_avl_c,v 1.1 2005/04/18 20:14:34 sturm Exp $
--- src/avl/avl.c.orig Sun Apr 17 02:44:43 2005
+++ src/avl/avl.c Sun Apr 17 02:47:25 2005
@@ -1063,9 +1063,11 @@ typedef struct _link_node {
static char balance_chars[3] = {'\\', '-', '/'};
static int
-default_key_printer (char * buffer, void * key)
+default_key_printer (char * buffer, size_t size, void * key)
{
- return sprintf (buffer, "%p", key);
+ snprintf (buffer, size, "%p", key);
+
+ return strlen(buffer);
}
/*
@@ -1108,8 +1110,8 @@ print_node (avl_key_printer_fun_type key
link_node * link)
{
char buffer[256];
- unsigned int width;
- width = key_printer (buffer, node->key);
+ size_t width;
+ width = key_printer (buffer, sizeof(buffer), node->key);
if (node->right) {
link_node here;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_avl_avl_h,v 1.1 2005/04/18 20:14:34 sturm Exp $
--- src/avl/avl.h.orig Sun Apr 17 02:44:39 2005
+++ src/avl/avl.h Sun Apr 17 02:45:06 2005
@@ -55,7 +55,7 @@ typedef int (*avl_key_compare_fun_type)
typedef int (*avl_iter_fun_type) (void * key, void * iter_arg);
typedef int (*avl_iter_index_fun_type) (unsigned long index, void * key, void * iter_arg);
typedef int (*avl_free_key_fun_type) (void * key);
-typedef int (*avl_key_printer_fun_type) (char *, void *);
+typedef int (*avl_key_printer_fun_type) (char *, size_t, void *);
/*
* <compare_fun> and <compare_arg> let us associate a particular compare