- added additional check to MmsValue_update for structure size mismatch
This commit is contained in:
parent
c08fe41cbb
commit
15ec6c7a7c
1 changed files with 11 additions and 6 deletions
|
@ -47,21 +47,25 @@ MmsValue_getBitStringByteSize(const MmsValue* self)
|
|||
return bitStringByteSize(self);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
updateStructuredComponent(MmsValue* self, const MmsValue* update)
|
||||
{
|
||||
int componentCount;
|
||||
MmsValue** selfValues;
|
||||
MmsValue** updateValues;
|
||||
|
||||
componentCount = self->value.structure.size;
|
||||
if (self->value.structure.size != update->value.structure.size)
|
||||
return false;
|
||||
|
||||
selfValues = self->value.structure.components;
|
||||
updateValues = update->value.structure.components;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < componentCount; i++) {
|
||||
MmsValue_update(selfValues[i], updateValues[i]);
|
||||
for (i = 0; i < self->value.structure.size; i++) {
|
||||
if (MmsValue_update(selfValues[i], updateValues[i]) == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
MmsValue*
|
||||
|
@ -223,7 +227,8 @@ MmsValue_update(MmsValue* self, const MmsValue* update)
|
|||
switch (self->type) {
|
||||
case MMS_STRUCTURE:
|
||||
case MMS_ARRAY:
|
||||
updateStructuredComponent(self, update);
|
||||
if (updateStructuredComponent(self, update) == false)
|
||||
return false;
|
||||
break;
|
||||
case MMS_BOOLEAN:
|
||||
self->value.boolean = update->value.boolean;
|
||||
|
|
Loading…
Add table
Reference in a new issue