From: Holger Schemel Date: Wed, 10 Jan 2018 09:41:23 +0000 (+0100) Subject: fixed potential off-by-one buffer overflow bug when recording tapes X-Git-Tag: 4.0.1.1~17 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=43a15ee9fa750d3089d23d3e244b91d9019d81d2;p=rocksndiamonds.git fixed potential off-by-one buffer overflow bug when recording tapes --- diff --git a/src/tape.c b/src/tape.c index 831659b6..5e55cb04 100644 --- a/src/tape.c +++ b/src/tape.c @@ -641,7 +641,10 @@ void TapeHaltRecording() return; tape.counter++; - tape.pos[tape.counter].delay = 0; + + // initialize delay for next tape entry (to be able to continue recording) + if (tape.counter < MAX_TAPE_LEN) + tape.pos[tape.counter].delay = 0; tape.length = tape.counter; tape.length_frames = GetTapeLengthFrames();