Corrected octet string decoding in BACapp module for string length of zero. Added zeroes at the end of an octet string when initialized. Bug found by ptransfer unit test.

This commit is contained in:
skarg
2012-05-12 15:39:16 +00:00
parent d0038e6456
commit c0f2af65e0
3 changed files with 26 additions and 13 deletions
+4 -2
View File
@@ -264,8 +264,10 @@ int bacapp_decode_data(
}
}
if (len == 0 && tag_data_type != BACNET_APPLICATION_TAG_NULL &&
tag_data_type != BACNET_APPLICATION_TAG_BOOLEAN) {
if ((len == 0) &&
(tag_data_type != BACNET_APPLICATION_TAG_NULL) &&
(tag_data_type != BACNET_APPLICATION_TAG_BOOLEAN) &&
(tag_data_type != BACNET_APPLICATION_TAG_OCTET_STRING)) {
/* indicate that we were not able to decode the value */
value->tag = MAX_BACNET_APPLICATION_TAG;
}