Skip to content

Commit

Permalink
Fix out-of-bounds read in wingui implementation (#312)
Browse files Browse the repository at this point in the history
Found with address sanitizer
  • Loading branch information
slipher authored Dec 12, 2023
1 parent 02a61c1 commit 70d2724
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wingui/pdcdisp.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ static void PDC_transform_line_given_hdc( const HDC hdc, const int lineno,
srcp -= x;
x = 0;
}
if( (srcp[len] & A_CHARTEXT) < MAX_UNICODE)
if( len < SP->cols - x && (srcp[len] & A_CHARTEXT) < MAX_UNICODE)
len++; /* draw an extra char to avoid leaving garbage on screen */
if( len > SP->cols - x)
len = SP->cols - x;
Expand Down

0 comments on commit 70d2724

Please sign in to comment.