Re: CVS: commit uwog abi/src/af/util/unix ut_debugmsg.cpp

From: Dom Lachowicz <domlachowicz_at_yahoo.com>
Date: Fri May 26 2006 - 15:21:06 CEST

Where do we use messages this large?

It's appropriate and desirable to use a much smaller
buf size (1024 or less here) and just use
vsnprintf(buf, sizeof(buf), ...).

If you want to see more, use a debugger. Please make
the bufsize smaller.

Best,
Dom

--- cvs@abisource.com wrote:

>
> Update of /cvsroot/abi/src/af/util/unix
> In directory
>
abiword.snt.utwente.nl:/tmp/cvs-serv30714/src/af/util/unix
>
> Modified Files:
> ut_debugmsg.cpp
> Log Message:
> Make sure that we can't get stack overflows when
> using _really_ long debugmessages (backport)
>
>
>
> Index: ut_debugmsg.cpp
>
===================================================================
> RCS file:
> /cvsroot/abi/src/af/util/unix/ut_debugmsg.cpp,v
> retrieving revision 1.10
> retrieving revision 1.11
> diff -u -d -r1.10 -r1.11
> --- ut_debugmsg.cpp 17 Oct 2004 00:40:30 -0000 1.10
> +++ ut_debugmsg.cpp 26 May 2006 12:10:51 -0000 1.11
> @@ -26,15 +26,17 @@
>
> #include "ut_debugmsg.h"
>
> +#define BUF_SIZE 20*1024
> +
> void _UT_OutputMessage(const char *s, ...)
> {
> #ifdef UT_DEBUG
> - char sBuf[20*1024];
> + char sBuf[BUF_SIZE];
> va_list marker;
>
> va_start(marker, s);
>
> - vsprintf(sBuf, s, marker);
> + vsnprintf(sBuf, BUF_SIZE, s, marker);
>
> fprintf(stderr,"DEBUG: %s",sBuf);
> #endif
>
> -----------------------------------------------
> To unsubscribe from this list, send a message to
> abisource-cvs-commit-request@abisource.com with the
> word
> unsubscribe in the message body.
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Received on Fri May 26 15:20:29 2006

This archive was generated by hypermail 2.1.8 : Fri May 26 2006 - 15:20:29 CEST