On 10/13/07, Vlad Seryakov <[EMAIL PROTECTED]> wrote: > I was able to find the location which causes the crash but i am not sure > how to fix it > > In function Ns_VALog i call vsnprintf directly, it works, when it is > called via Ns_DStringVPintf it crashes. using va_copy does not help >
diff -r 22a912b584eb nsd/dstring.c --- a/nsd/dstring.c Fri Oct 12 20:35:13 2007 +0100 +++ b/nsd/dstring.c Sat Oct 13 19:46:22 2007 +0100 @@ -176,10 +176,11 @@ Ns_DStringPrintf(Ns_DString *dsPtr, CONS */ char * -Ns_DStringVPrintf(Ns_DString *dsPtr, CONST char *fmt, va_list ap) -{ - char *buf; - int origLength, newLength, bufLength, result; +Ns_DStringVPrintf(Ns_DString *dsPtr, CONST char *fmt, va_list apSrc) +{ + char *buf; + int origLength, newLength, bufLength, result; + va_list ap; origLength = dsPtr->length; @@ -205,11 +206,13 @@ Ns_DStringVPrintf(Ns_DString *dsPtr, CON buf = dsPtr->string + origLength; bufLength = newLength - origLength; + va_copy(ap, apSrc); #ifdef __WIN32 result = _vsnprintf_s(buf, bufLength, fmt, ap); #else result = vsnprintf(buf, bufLength, fmt, ap); #endif + va_end(ap); /* * Check for overflow and retry. For win32 just double the buffer size @@ -229,11 +232,13 @@ Ns_DStringVPrintf(Ns_DString *dsPtr, CON buf = dsPtr->string + origLength; bufLength = newLength - origLength; + va_copy(ap, apSrc); #ifdef __WIN32 result = _vsnprintf_s(buf, bufLength, fmt, ap); #else result = vsnprintf(buf, bufLength, fmt, ap); #endif + va_end(ap); } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel