From 87111a8bbbe44de0223192dbead37d5c91654488 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 bfccf0c7..34a68569 100644 --- a/src/mms/iso_mms/common/mms_type_spec.c +++ b/src/mms/iso_mms/common/mms_type_spec.c @@ -65,9 +65,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) {