Skip to content

Commit

Permalink
Check for negative index in dlt_file_message
Browse files Browse the repository at this point in the history
Fixes COVESA#436

Signed-off-by: Michael Methner <mmethner@de.adit-jv.com>
  • Loading branch information
Michael Methner committed Jan 27, 2023
1 parent 198715e commit 8ac9a08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/shared/dlt_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,7 @@ DltReturnValue dlt_file_message(DltFile *file, int index, int verbose)
return DLT_RETURN_WRONG_PARAMETER;

/* check if message is in range */
if (index >= file->counter) {
if (index < 0 || index >= file->counter) {
dlt_vlog(LOG_WARNING, "Message %d out of range!\r\n", index);
return DLT_RETURN_WRONG_PARAMETER;
}
Expand Down

0 comments on commit 8ac9a08

Please sign in to comment.