Skip to content

Commit

Permalink
bits: fix bit_TV_to_utf8_codepage heap-buffer-overflow
Browse files Browse the repository at this point in the history
Fixes GH #881
  • Loading branch information
rurban committed Nov 29, 2023
1 parent ba6aa54 commit e685e68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -3202,7 +3202,7 @@ bit_TV_to_utf8_codepage (const char *restrict src, const BITCODE_RS codepage)
if (!codepage)
return (char *)src;
// UTF8 encode
while ((c = *tmp) && i < destlen)
while (i < destlen && (char*)tmp < &src[srclen] && (c = *tmp))
{
wchar_t wc;
tmp++;
Expand Down

0 comments on commit e685e68

Please sign in to comment.