From 73417cdbf2207f7619f2c0c7890ddc8cea004472 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Tue, 28 May 2019 16:05:34 +0200 Subject: [PATCH] - Added additional check in MmsVariableSpecification_getChildValue --- src/mms/iso_mms/common/mms_type_spec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mms/iso_mms/common/mms_type_spec.c b/src/mms/iso_mms/common/mms_type_spec.c index 7c3f2ab5..76c4cfea 100644 --- a/src/mms/iso_mms/common/mms_type_spec.c +++ b/src/mms/iso_mms/common/mms_type_spec.c @@ -68,9 +68,13 @@ directChildStrLen(const char* childId) MmsValue* MmsVariableSpecification_getChildValue(MmsVariableSpecification* typeSpec, MmsValue* value, const char* childId) { - if (typeSpec->type == MMS_STRUCTURE) { + if ((typeSpec->type == MMS_STRUCTURE) && (value->type == MMS_STRUCTURE)) { size_t childLen = directChildStrLen(childId); int i; + + if (typeSpec->typeSpec.structure.elementCount != value->value.structure.size) + return NULL; + for (i = 0; i < typeSpec->typeSpec.structure.elementCount; i++) { if (strlen(typeSpec->typeSpec.structure.elements[i]->name) == childLen) {