Added handling for bacapp decode value returning error codes.

This commit is contained in:
skarg
2010-10-12 03:02:05 +00:00
parent e9249b5b5e
commit 86dbaf409b
4 changed files with 49 additions and 18 deletions
+5 -4
View File
@@ -125,6 +125,11 @@ int rpm_ack_decode_service_request(
bacapp_decode_application_data(apdu, apdu_len,
value);
}
if (len <= 0) {
/* problem decoding */
/* calling function will free the memory */
return BACNET_STATUS_ERROR;
}
decoded_len += len;
apdu_len -= len;
apdu += len;
@@ -134,10 +139,6 @@ int rpm_ack_decode_service_request(
apdu++;
break;
} else {
/* nothing decoded and no closing tag, so malformed */
if (len == 0) {
return -1;
}
old_value = value;
value =
calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));