From 042ec19495c0e3302708ef2aa2449356a2b525fe Mon Sep 17 00:00:00 2001 From: "Quentin E. / iDeath" Date: Mon, 3 Apr 2023 23:48:56 +0200 Subject: [PATCH] potential fix for attachment infinite loop crash (#1183) --- src/hooks/protections/can_apply_data.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hooks/protections/can_apply_data.cpp b/src/hooks/protections/can_apply_data.cpp index 59349ef3..4c751c51 100644 --- a/src/hooks/protections/can_apply_data.cpp +++ b/src/hooks/protections/can_apply_data.cpp @@ -495,10 +495,15 @@ namespace big if (object == nullptr) return false; - while (object = g_pointers->m_get_entity_attached_to(object)) + constexpr size_t reasonable_limit = 150; + size_t i = 0; + while (object && i < reasonable_limit) { if (object->m_net_object && object->m_net_object->m_object_id == attached_to_net_id) return true; + + object = g_pointers->m_get_entity_attached_to(object); + i++; } return false;