Skip to content

Commit

Permalink
In reality, tbuff[5] will be zeroed by the strcpy() two lines earlier…
Browse files Browse the repository at this point in the history
…. But gcc-7.5.0 doesn't appear to realize that; it complains that 'comment_observation' may read uninitialized space. Later gccs appear to have figured this one out, but we now explicitly set tbuff[5] just to suppress the warning (which, with -Werror, is an error).
  • Loading branch information
Bill-Gray committed May 4, 2023
1 parent 8f77bb2 commit 8af1023
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mpc_obs.cpp
Expand Up @@ -3681,12 +3681,13 @@ OBSERVE FAR *load_observations( FILE *ifile, const char *packed_desig,
error_code = get_satellite_offset( second_line, vect);
if( error_code)
{
char tbuff[8];
char tbuff[6];

rval[i].flags |= OBS_DONT_USE;
rval[i].is_included = 0;
strcpy( tbuff, "?off ");
tbuff[4] = (char)( '0' - error_code);
tbuff[5] = '\0';
comment_observation( rval + i, tbuff);
n_bad_satellite_offsets++;
debug_printf( "Error code %d; offending line was:\n%s\n",
Expand Down

0 comments on commit 8af1023

Please sign in to comment.