From fdde0743e04d6f2f1be943211cd36d94bce7a0b7 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Sat, 30 Mar 2024 18:46:16 -0400 Subject: [PATCH] decompiler-cpp: Add missing for-loop index variable check Prevent indexing out of bounds --- Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc index 0237adb820..6d34ead0cf 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ifacedecomp.cc @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -1844,7 +1844,7 @@ void IfcProtooverride::execute(istream &s) s >> ws; Address callpoint(parse_machaddr(s,discard,*dcp->conf->types)); int4 i; - for(i=0;dcp->fd->numCalls();++i) + for(i=0;ifd->numCalls();++i) if (dcp->fd->getCallSpecs(i)->getOp()->getAddr() == callpoint) break; if (i == dcp->fd->numCalls()) throw IfaceExecutionError("No call is made at this address");