Skip to content

Commit

Permalink
Prevent OOB read in tsk_unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Feb 23, 2025
1 parent b6e53ee commit 896eec5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tsk/base/tsk_unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ tsk_UTF16toUTF8(TSK_ENDIAN_ENUM endian, const UTF16 ** sourceStart,
const UTF32 byteMark = 0x80;
const UTF16 *oldSource = source; /* In case we have to back up because of target overflow. */

// Need at least 2 bytes
// Need at least 2 bytes. Note that source is a 16-bit pointer.
if (source + 1 < sourceEnd) {
result = TSKsourceExhausted;
break;
}
ch = tsk_getu16(endian, (uint8_t *) source);
source++;

Expand Down

0 comments on commit 896eec5

Please sign in to comment.