Skip to content

Commit 2d158a3

Browse files
authored
Merge pull request #1 from adrianghc/fix-underflow
Fix potential underflow issue in uds.c
2 parents 786ddb1 + 7609f20 commit 2d158a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/uds/uds.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static bool handle_positive_response(DiagnosticRequestHandle* handle,
221221
response->completed = true;
222222

223223
uint8_t payload_index = 1 + handle->request.pid_length;
224-
response->payload_length = MAX(0, message->size - payload_index);
224+
response->payload_length = MAX(0, (int)(message->size - payload_index));
225225
response->payload_length = MIN(MAX_UDS_RESPONSE_PAYLOAD_LENGTH,
226226
response->payload_length);
227227
if(response->payload_length > 0) {

0 commit comments

Comments
 (0)