Change RP and RPM demos to send an Abort if the APDU length is longer than max-APDU-length-accepted. Thank you, Carlos!
This commit is contained in:
@@ -154,10 +154,22 @@ void handler_read_property(
|
|||||||
len =
|
len =
|
||||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
rp_ack_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
service_data->invoke_id, &data);
|
service_data->invoke_id, &data);
|
||||||
|
if (len > service_data->max_resp) {
|
||||||
|
/* we don't support segmentation - send an abort */
|
||||||
|
len =
|
||||||
|
abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id, ABORT_REASON_SEGMENTATION_NOT_SUPPORTED,
|
||||||
|
true);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "RP: Sending Ack!\n");
|
fprintf(stderr, "RP: Message too large. Sending Abort!\n");
|
||||||
#endif
|
#endif
|
||||||
error = false;
|
goto RP_ABORT;
|
||||||
|
} else {
|
||||||
|
#if PRINT_ENABLED
|
||||||
|
fprintf(stderr, "RP: Sending Ack!\n");
|
||||||
|
#endif
|
||||||
|
error = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
if (len == -2) {
|
if (len == -2) {
|
||||||
|
|||||||
@@ -423,6 +423,17 @@ void handler_read_property_multiple(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
if (pdu_len > service_data->max_resp) {
|
||||||
|
/* we don't support segmentation - send an abort */
|
||||||
|
apdu_len =
|
||||||
|
abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
|
||||||
|
service_data->invoke_id, ABORT_REASON_SEGMENTATION_NOT_SUPPORTED,
|
||||||
|
true);
|
||||||
|
#if PRINT_ENABLED
|
||||||
|
fprintf(stderr, "RP: Message too large. Sending Abort!\n");
|
||||||
|
#endif
|
||||||
|
goto RPM_ABORT;
|
||||||
|
}
|
||||||
RPM_ABORT:
|
RPM_ABORT:
|
||||||
pdu_len = apdu_len + npdu_len;
|
pdu_len = apdu_len + npdu_len;
|
||||||
bytes_sent =
|
bytes_sent =
|
||||||
|
|||||||
Reference in New Issue
Block a user