Always terminate escape return string.
This commit is contained in:
parent
a373535c75
commit
11e11d97b2
|
@ -129,7 +129,8 @@ Loggable::escape ( const char *s )
|
||||||
{
|
{
|
||||||
static char r[512];
|
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 )
|
if ( '\n' == *s )
|
||||||
{
|
{
|
||||||
|
@ -145,6 +146,8 @@ Loggable::escape ( const char *s )
|
||||||
r[ i ] = *s;
|
r[ i ] = *s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r[ i ] = '\0';
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue