From da69f7faa99421c0f8c83255a475563b17b379e1 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 25 Jun 2024 15:12:14 +0200 Subject: [PATCH] Don't cast address to scalar (this is fishy) --- LEGO1/lego/legoomni/src/main/legomain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index a0cc4113..c96ada2f 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -501,7 +501,8 @@ MxAtomId* LegoOmni::GetScriptAtom(MxU32 p_index) MxS32 LegoOmni::GetScriptIndex(const char* p_key) { for (MxS32 i = 0; i < 19; i++) { - if ((MxS32) &m_scripts[i] != -4 && !strcmpi(m_scripts[i].GetKey(), p_key)) { + // FIXME: this looks very fishy. Is this guarding against out-of-bounds access? + if ((MxS32*) (&m_scripts[i]) != (MxS32*) -4 && !strcmpi(m_scripts[i].GetKey(), p_key)) { return m_scripts[i].GetIndex(); } }