decompiler-cpp: Add missing for-loop index variable check

Prevent indexing out of bounds
This commit is contained in:
Eric Kilmer 2024-03-30 18:46:16 -04:00 committed by caheckman
parent 2a7897c366
commit fdde0743e0

View File

@ -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;i<dcp->fd->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");