X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/96c92647f055deba9bfbf91f1198ab5d3b06cae4..b3d64b2b83cc59c9f01e65908072d606a1515bc8:/loopy.c diff --git a/loopy.c b/loopy.c index 7570219..f70e5b1 100644 --- a/loopy.c +++ b/loopy.c @@ -1210,8 +1210,14 @@ static char *encode_solve_move(const game_state *state) } } - /* No point in doing sums like that if they're going to be wrong */ - assert(strlen(ret) == (size_t)len); + /* + * Ensure we haven't overrun the buffer we allocated (which we + * really shouldn't have, since we computed its maximum size). + * Note that this assert is <= rather than ==, because the + * solver is permitted to produce an incomplete solution in + * which case the buffer will be only partially used. + */ + assert(strlen(ret) <= (size_t)len); return ret; } @@ -2363,7 +2369,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->linewidth = max(1,tilesize/16); } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(4 * NCOLOURS, float); @@ -2640,11 +2646,6 @@ static float game_flash_length(game_state *oldstate, game_state *newstate, return 0.0F; } -static int game_wants_statusbar(void) -{ - return FALSE; -} - static int game_timing_state(game_state *state, game_ui *ui) { return TRUE; @@ -2751,7 +2752,7 @@ const struct game thegame = { game_anim_length, game_flash_length, TRUE, FALSE, game_print_size, game_print, - game_wants_statusbar, + FALSE, /* wants_statusbar */ FALSE, game_timing_state, - 0, /* mouse_priorities */ + 0, /* flags */ };