From a3939bdec15f9299ae9a681255fa93c47113870a Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 24 Jan 2023 18:38:13 -0700 Subject: Fix UAF on C++ BinaryView plugin init, improve demangler and BinaryView APIs --- architecture.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'architecture.cpp') diff --git a/architecture.cpp b/architecture.cpp index 7fcc43a8..3c44202f 100644 --- a/architecture.cpp +++ b/architecture.cpp @@ -1252,7 +1252,10 @@ void Architecture::RegisterRelocationHandler(const string& viewName, RelocationH Ref Architecture::GetRelocationHandler(const std::string& viewName) { - return new CoreRelocationHandler(BNArchitectureGetRelocationHandler(m_object, viewName.c_str())); + auto handler = BNArchitectureGetRelocationHandler(m_object, viewName.c_str()); + if (!handler) + return nullptr; + return new CoreRelocationHandler(handler); } bool Architecture::IsBinaryViewTypeConstantDefined(const string& type, const string& name) -- cgit v1.3.1