diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-03-31 20:38:31 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-03-31 20:45:37 +0100 |
| commit | 91735e5019be84d2fa693c5d40746c818ace28f8 (patch) | |
| tree | d45177442b311cf1d567b959ca08be12d8564cd2 | |
| parent | 1af1204b9c33c9c03b2e0fe66c2f07d9729cbc72 (diff) | |
| download | puzzles-91735e5019be84d2fa693c5d40746c818ace28f8.zip puzzles-91735e5019be84d2fa693c5d40746c818ace28f8.tar.gz puzzles-91735e5019be84d2fa693c5d40746c818ace28f8.tar.bz2 puzzles-91735e5019be84d2fa693c5d40746c818ace28f8.tar.xz | |
Correct a range check in Magnets' layout verification
Squares in the grid are numbered from 0, so the upper limit check
needs to use "<=" rather than "<". Without this, invalid descriptions
can cause a read overrun off the end of the board.
| -rw-r--r-- | magnets.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -520,7 +520,7 @@ nextchar: * (i.e. each end points to the other) */ for (idx = 0; idx < state->wh; idx++) { if (state->common->dominoes[idx] < 0 || - state->common->dominoes[idx] > state->wh || + state->common->dominoes[idx] >= state->wh || state->common->dominoes[state->common->dominoes[idx]] != idx) { *prob = "Domino descriptions inconsistent"; goto done; |