From d577f378e2fa52a6689187eb103f07fc337560d4 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Tue, 3 Sep 2019 10:41:13 +0200 Subject: [PATCH] Menu: Error checking for strings.lst parsing, as some mods (The Ship) can't do access out-of-bounds string indices. --- src/menu-fn/strings.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/menu-fn/strings.cpp b/src/menu-fn/strings.cpp index 19a4cd07..0208c931 100644 --- a/src/menu-fn/strings.cpp +++ b/src/menu-fn/strings.cpp @@ -577,9 +577,13 @@ void Strings_Init(void) if (stringslst >= 0) { int lc; while((lstline = fgets(stringslst))) { - lc = tokenize(lstline); + lc = tokenize_console(lstline); if (lc == 2) { - m_reslbl[stof(argv(0))] = argv(1); + float i = stof(argv(0)); + /* you never know the vile stuff mods do. */ + if (i < m_reslbl.length) { + m_reslbl[stof(argv(0))] = argv(1); + } } } fclose(stringslst);