Skip to content

Commit

Permalink
Valgrind warned of possible reading of uninitialized memory if extrac…
Browse files Browse the repository at this point in the history
…t_lat_lon() was fed a 'buff' consisting only of zero or more spaces. In such a case, we strchr( compass, '\0');, get a non-zero pointer, and cheerfully advance past the end of the array.
  • Loading branch information
Bill-Gray committed Apr 15, 2024
1 parent b71dbc1 commit e7be497
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mpc_code.cpp
Expand Up @@ -525,6 +525,8 @@ static int extract_lat_lon( const char *buff, size_t *bytes_read, double *value)

while( *tptr == ' ')
tptr++;
if( !*tptr)
return( GOT_NOTHING);
if( strchr( compass, *tptr))
compass_byte = *tptr++;
if( !strncasecmp( tptr, "alt", 3))
Expand Down

0 comments on commit e7be497

Please sign in to comment.