From 9404622c5afca4dbb0c7e0b977c3c7ec2b9e0e81 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Fri, 9 Jun 2023 15:50:39 +0100 Subject: [PATCH] - IEDConnection: check for index out of bounds in ClientReport_getReasonForInclusion --- src/iec61850/client/client_report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iec61850/client/client_report.c b/src/iec61850/client/client_report.c index fbaa74c2..af12d26a 100644 --- a/src/iec61850/client/client_report.c +++ b/src/iec61850/client/client_report.c @@ -139,7 +139,7 @@ ClientReport_getRptId(ClientReport self) ReasonForInclusion ClientReport_getReasonForInclusion(ClientReport self, int elementIndex) { - if (self->reasonForInclusion != NULL) + if ((self->reasonForInclusion != NULL) && (elementIndex < self->dataSetSize) && (elementIndex >= 0)) return self->reasonForInclusion[elementIndex]; else return IEC61850_REASON_NOT_INCLUDED;