From 0201979c55010c26b23863908fb278a61dcb766c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 29 Mar 2018 00:01:17 +0200 Subject: BLADERUNNER: Fix buffer overflow in PoliceMaze --- engines/bladerunner/script/police_maze.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/bladerunner') diff --git a/engines/bladerunner/script/police_maze.cpp b/engines/bladerunner/script/police_maze.cpp index aaed223a57..a85fa07451 100644 --- a/engines/bladerunner/script/police_maze.cpp +++ b/engines/bladerunner/script/police_maze.cpp @@ -186,15 +186,15 @@ void PoliceMazeTargetTrack::add(int trackId, float startX, float startY, float s double coefY = (endY - startY) * coef; double coefZ = (endZ - startZ) * coef; - for (int i = 0; i < steps; i++) { + for (int i = 0; i < steps - 1; i++) { _points[i].x = i * coefX + startX; _points[i].y = i * coefY + startY; _points[i].z = i * coefZ + startZ; } - _points[steps].x = endX; - _points[steps].y = endY; - _points[steps].z = endZ; + _points[steps - 1].x = endX; + _points[steps - 1].y = endY; + _points[steps - 1].z = endZ; _isPaused = !isActive; } -- cgit v1.2.3