Skip to content

Commit 19202ea

Browse files
committed
Unsigned variable compared < 0
When filling the screen with spaces, the code was subtracting two unsigned numbers and checking if they were negative. Changed to use a comparison and adjust the subtraction as appropriate, then did the rest of the size expansion. Affected function: wolfSSH_ClearScreen. Issue: F-48
1 parent 0d6dad3 commit 19202ea

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/wolfterm.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ static void wolfSSH_ClearScreen(WOLFSSH_HANDLE handle, word32 x1, word32 y1, wor
119119
fill = x2 - x1;
120120
}
121121
else { /* | y1 - y2 | * maxX - x1 + x2 */
122-
fill = y1 - y2;
123-
if (fill < 0)
124-
fill += fill * 2;
125-
fill = fill * maxX - x1 + x2;
122+
fill = ((y1 > y2) ? y1 - y2 : y2 - y1) * maxX - x1 + x2;
126123
}
127124

128125
FillConsoleOutputCharacterA(handle, ' ', fill, start, &w);

0 commit comments

Comments
 (0)