29 lines
810 B
Plaintext
29 lines
810 B
Plaintext
|
$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;
|