From: miker Date: Wed, 3 Aug 2005 14:40:20 +0000 (+0000) Subject: bugfix for buffer_fadd X-Git-Tag: osrf_rel_2_0_1~1418 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b411067aba739023b10e8016565ce858bd39c219;p=OpenSRF.git bugfix for buffer_fadd git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@455 9efc2488-bf62-4759-914b-345cdb29e865 --- 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) {