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) {