Skip to content

Commit

Permalink
Prevent crash when too many exception events happen during string output
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Jun 17, 2024
1 parent 7761f26 commit 64af329
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Src/orbcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ void _expex( const char *fmt, ... )
_r.dwtte = _timestamp();
}

/* See if we exceeded max length...if so then output what we have and start a fresh buffer */
if ( MAX_STRING_LENGTH - strlen( _r.dwtText ) < 100 )
{
fputs( _r.dwtText, stdout );
_r.dwtText[0] = 0;
}

/* Construct the output */
_printTimestamp( &_r.dwtText[strlen( _r.dwtText )] );
int maxLen = MAX_STRING_LENGTH - strlen( _r.dwtText );
Expand Down

0 comments on commit 64af329

Please sign in to comment.