Always terminate escape return string.

This commit is contained in:
Jonathan Moore Liles 2008-05-06 00:34:46 -05:00
parent a373535c75
commit 11e11d97b2
1 changed files with 4 additions and 1 deletions

View File

@ -129,7 +129,8 @@ Loggable::escape ( const char *s )
{
static char r[512];
for ( size_t i = 0; *s && i < sizeof( r ); ++i, ++s )
size_t i = 0;
for ( ; *s && i < sizeof( r ); ++i, ++s )
{
if ( '\n' == *s )
{
@ -145,6 +146,8 @@ Loggable::escape ( const char *s )
r[ i ] = *s;
}
r[ i ] = '\0';
return r;
}