Re: [IBPP-DISCUSS] another bug, crashes app in debug mode with IBPP_WINDOWS defined
IBPP is a C++ client class library for FirebirdSQL
Status: Inactive
Brought to you by:
epocman
From: Olivier M. <om...@ti...> - 2004-02-12 11:54:43
|
On 12/02/2004 12:16 GMT+1, Val Samko (DigiWays) wrote: > void DebugOutput(const char* format, ...) > { > #ifdef IBPP_WINDOWS > if (format != 0) > { > char buffer[1024] = "IBPP: "; // 6 prefix characters > va_list argptr; > va_start(argptr, format); > vsprintf(&buffer[6], format, argptr); // 6, see above > va_end(argptr); > ::OutputDebugString(buffer); > } > else ::OutputDebugString("IBPP: Calling DebugOutput(0) !"); > #endif > } > > Possible solutions: > 1. Replace ugly `vsprintf` (aka "overflow my buffer") with `vsnprintf` > which lets you set the max buffer size. > > 2. Get rid of the error prone `vsprintf` and redefine `DebugOutput` > as: > > void DebugOutput(const std::string& message) > { > #ifdef IBPP_WINDOWS > ::OutputDebugString(message.c_str()); > #endif > } Any of these solutions will do. -- Best Regards, Olivier Mascia |