From 6563e570733514246c32506efe91bdef8f93ea47 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Mon, 14 Sep 2020 18:24:40 +0200 Subject: [PATCH] * IEC 61850 client: added missing check in ClientReportControlBlock_getConfRev --- src/iec61850/client/client_report_control.c | 5 ++++- src/iec61850/inc/iec61850_client.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/iec61850/client/client_report_control.c b/src/iec61850/client/client_report_control.c index d1ba6ede..390863e4 100644 --- a/src/iec61850/client/client_report_control.c +++ b/src/iec61850/client/client_report_control.c @@ -201,7 +201,10 @@ ClientReportControlBlock_getConfRev(ClientReportControlBlock self) int ClientReportControlBlock_getOptFlds(ClientReportControlBlock self) { - return (MmsValue_getBitStringAsInteger(self->optFlds) / 2); + if (self->optFlds) + return (MmsValue_getBitStringAsInteger(self->optFlds) / 2); + else + return 0; } void diff --git a/src/iec61850/inc/iec61850_client.h b/src/iec61850/inc/iec61850_client.h index 5e815ff2..ffe8ff1f 100644 --- a/src/iec61850/inc/iec61850_client.h +++ b/src/iec61850/inc/iec61850_client.h @@ -1582,6 +1582,7 @@ ClientReportControlBlock_getConfRev(ClientReportControlBlock self); * \brief Gets the OptFlds parameter of the RCB (decides what information to include in a report) * * \param self the RCB instance + * * \return bit field representing the optional fields of a report (uses flags from \ref REPORT_OPTIONS) */ LIB61850_API int