If you try to print a string longer than std_sprintf's default 512 char buffer size, dbg-cli crashes. At least for me, on a x86_64 linux machine.
Here's a fix:
--- dbgbase/dbgbase_globals.cpp.orig 2006-02-03 10:22:02.000000000 -0800
+++ dbgbase/dbgbase_globals.cpp 2006-02-03 10:55:23.000000000 -0800
@@ -141,14 +141,16 @@
}
int __cdecl std_sprintf(std::string& buf, const char *format ...) {
- va_list args;
+ va_list args, args_copy;
int sz, ret_val, i;
char *cbuf = NULL;
va_start(args, format);
for (sz=512, i=0; i < 16; i++, sz=sz*2) {
+ va_copy(args_copy, args);
cbuf = new char[sz];
- ret_val = vsnprintf(cbuf, sz, format, args);
+ ret_val = vsnprintf(cbuf, sz, format, args_copy);
+ va_end(args_copy);
if (ret_val >= 0 && ret_val < sz) break;
delete cbuf;
cbuf = NULL;
|
Note this patch is similar to
viewtopic.php?t=5855&highlight=stdsprintf&sid=a9226387795e352f550e33a9bd711eae but that did not prevent my crash, while this one does. An important difference!