Fixed some warnings flagged by IAR C-STAT static analysis tool.
This commit is contained in:
@@ -378,8 +378,8 @@ void apdu_retries_set(
|
||||
/* When network communications are completely disabled,
|
||||
only DeviceCommunicationControl and ReinitializeDevice APDUs
|
||||
shall be processed and no messages shall be initiated.
|
||||
When the initiation of communications is disabled,
|
||||
all APDUs shall be processed and responses returned as
|
||||
When the initiation of communications is disabled,
|
||||
all APDUs shall be processed and responses returned as
|
||||
required... */
|
||||
static bool apdu_confirmed_dcc_disabled(
|
||||
uint8_t service_choice)
|
||||
@@ -413,7 +413,7 @@ static bool apdu_unconfirmed_dcc_disabled(
|
||||
bool status = false;
|
||||
|
||||
if (dcc_communication_disabled()) {
|
||||
/* there are no Unconfirmed messages that
|
||||
/* there are no Unconfirmed messages that
|
||||
can be processed in this state */
|
||||
status = true;
|
||||
} else if (dcc_communication_initiation_disabled()) {
|
||||
@@ -462,8 +462,7 @@ void apdu_handler(
|
||||
/* PDU Type */
|
||||
switch (apdu[0] & 0xF0) {
|
||||
case PDU_TYPE_CONFIRMED_SERVICE_REQUEST:
|
||||
len =
|
||||
(int) apdu_decode_confirmed_service_request(&apdu[0],
|
||||
apdu_decode_confirmed_service_request(&apdu[0],
|
||||
apdu_len, &service_data, &service_choice, &service_request,
|
||||
&service_request_len);
|
||||
if (apdu_confirmed_dcc_disabled(service_choice)) {
|
||||
|
||||
@@ -292,7 +292,9 @@ int bacapp_decode_data(
|
||||
(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;
|
||||
if (value) {
|
||||
value->tag = MAX_BACNET_APPLICATION_TAG;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -309,7 +311,7 @@ int bacapp_decode_application_data(
|
||||
uint32_t len_value_type = 0;
|
||||
|
||||
/* FIXME: use max_apdu_len! */
|
||||
max_apdu_len = max_apdu_len;
|
||||
(void)max_apdu_len;
|
||||
if (apdu && value && !IS_CONTEXT_SPECIFIC(*apdu)) {
|
||||
value->context_specific = false;
|
||||
tag_len =
|
||||
@@ -446,7 +448,7 @@ int bacapp_decode_application_data_len(
|
||||
uint32_t len_value_type = 0;
|
||||
|
||||
/* FIXME: use max_apdu_len! */
|
||||
max_apdu_len = max_apdu_len;
|
||||
(void)max_apdu_len;
|
||||
if (apdu && !IS_CONTEXT_SPECIFIC(*apdu)) {
|
||||
tag_len =
|
||||
decode_tag_number_and_value(&apdu[0], &tag_number,
|
||||
@@ -798,7 +800,7 @@ int bacapp_decode_context_data_len(
|
||||
uint8_t tag = 0;
|
||||
|
||||
/* FIXME: use max_apdu_len! */
|
||||
max_apdu_len = max_apdu_len;
|
||||
(void)max_apdu_len;
|
||||
if (apdu && IS_CONTEXT_SPECIFIC(*apdu)) {
|
||||
tag_len =
|
||||
decode_tag_number_and_value(&apdu[0], &tag_number,
|
||||
|
||||
@@ -883,8 +883,10 @@ int encode_octet_string(
|
||||
to bounds check since it might not be the only data chunk */
|
||||
len = (int) octetstring_length(octet_string);
|
||||
value = octetstring_value(octet_string);
|
||||
for (i = 0; i < len; i++) {
|
||||
apdu[i] = value[i];
|
||||
if (value) {
|
||||
for (i = 0; i < len; i++) {
|
||||
apdu[i] = value[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ int rp_decode_service_request(
|
||||
uint32_t array_value = 0; /* for decoding */
|
||||
|
||||
/* check for value pointers */
|
||||
if (rpdata != NULL) {
|
||||
if (rpdata) {
|
||||
/* Must have at least 2 tags, an object id and a property identifier
|
||||
* of at least 1 byte in length to have any chance of parsing */
|
||||
if (apdu_len < 7) {
|
||||
@@ -142,7 +142,9 @@ int rp_decode_service_request(
|
||||
|
||||
if (len < apdu_len) {
|
||||
/* If something left over now, we have an invalid request */
|
||||
rpdata->error_code = ERROR_CODE_REJECT_TOO_MANY_ARGUMENTS;
|
||||
if (rpdata) {
|
||||
rpdata->error_code = ERROR_CODE_REJECT_TOO_MANY_ARGUMENTS;
|
||||
}
|
||||
return BACNET_STATUS_REJECT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user