From 7fba753f9d361908762a1c6765536211d8eb3e49 Mon Sep 17 00:00:00 2001 From: Goober5000 Date: Thu, 11 Apr 2024 14:53:24 -0400 Subject: [PATCH] model range fix Use the correct upper bounds check for `model_get()`. --- code/model/modelread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/modelread.cpp b/code/model/modelread.cpp index 4647f9e0a5a..66e0d24c56b 100644 --- a/code/model/modelread.cpp +++ b/code/model/modelread.cpp @@ -3842,7 +3842,7 @@ polymodel * model_get(int model_num) Assertion( Polygon_models[num], "No model with id %d found. Please backtrace and investigate.\n", num ); Assertion( Polygon_models[num]->id == model_num, "Index collision between model %s and requested model %d. Please backtrace and investigate.\n", Polygon_models[num]->filename, model_num ); - if (num < 0 || num > MAX_POLYGON_MODELS || !Polygon_models[num] || Polygon_models[num]->id != model_num) + if (num < 0 || num >= MAX_POLYGON_MODELS || !Polygon_models[num] || Polygon_models[num]->id != model_num) return NULL; return Polygon_models[num];