From e8d9a9d184bc7f8890815e2290b1730c4c58a705 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 10 Aug 2021 11:26:06 -0400 Subject: [PATCH] Fix out-of-bounds access in memscan.field_offset() Fixes #1907 --- library/lua/memscan.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/lua/memscan.lua b/library/lua/memscan.lua index 78a9e7b8c..34b030d4e 100644 --- a/library/lua/memscan.lua +++ b/library/lua/memscan.lua @@ -310,7 +310,7 @@ function field_ref(handle,...) end function field_offset(type,...) - local tmp = df.new('intptr_t') -- pointer to nullptr + local tmp = df.new('int8_t', df.sizeof(type)) local _, haddr = df.sizeof(tmp) local handle = df.reinterpret_cast(type, tmp) local _, addr = df.sizeof(field_ref(handle,...))