From b411067aba739023b10e8016565ce858bd39c219 Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 3 Aug 2005 14:40:20 +0000 Subject: [PATCH] bugfix for buffer_fadd git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@455 9efc2488-bf62-4759-914b-345cdb29e865 --- src/utils/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/utils.c b/src/utils/utils.c index 606aaf6..60d665a 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -107,7 +107,10 @@ int buffer_fadd(growing_buffer* gb, const char* format, ... ) { va_list args; - int len = strlen(format) + 1024; + va_start(args, format); + int len = vsnprintf(NULL, 0, format, args); + len += 1; + char buf[len]; memset(buf, 0, len); @@ -119,7 +122,6 @@ int buffer_fadd(growing_buffer* gb, const char* format, ... ) { } - int buffer_add(growing_buffer* gb, char* data) { -- 2.11.0