On 22/9/21 2:45 am, Ryan Long wrote: > --- > tester/covoar/TraceReaderLogQEMU.cc | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/tester/covoar/TraceReaderLogQEMU.cc > b/tester/covoar/TraceReaderLogQEMU.cc > index c303d08..91ed5c7 100644 > --- a/tester/covoar/TraceReaderLogQEMU.cc > +++ b/tester/covoar/TraceReaderLogQEMU.cc > @@ -53,8 +53,8 @@ > > bool ReadUntilFound( std::ifstream& file, const char* line ) > { > - char discardBuff[100]; > - size_t len = strlen( line ); > + char discardBuff[100];
100 bytes on the stack and not initialised ... > + size_t len = strlen( line );> > do { > file.read( discardBuff, 99 ); Read one less than the buffer so index 99 is still not initialised ... > @@ -62,9 +62,11 @@ bool ReadUntilFound( std::ifstream& file, const char* line > ) > return false; > } > > - if ( strncmp( discardBuff, line, len ) == 0 ) > + if ( strncmp( discardBuff, line, len ) == 0 ) { Making a call that assumes index 99 is '\0'! Does the discard buffer need to be memset to 0? What if the length of line is greater than 100? Is that a valid find and so a partial match is OK? Do the lengths need to match? Chris _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel