mirror of https://github.com/wolfSSL/wolfssh.git
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. If the second point is before the first, set the fill length to 0. Affected function: wolfSSH_ClearScreen. Issue: F-48pull/892/head
parent
6a3e97d12b
commit
331048d701
|
|
@ -115,14 +115,15 @@ static void wolfSSH_ClearScreen(WOLFSSH_HANDLE handle, word32 x1, word32 y1, wor
|
|||
start.Y = y1;
|
||||
|
||||
/* get number of cells */
|
||||
if (y1 == y2) { /* on same line so is x2 - x1 */
|
||||
fill = x2 - x1;
|
||||
if (y2 == y1) { /* on same line so is x2 - x1 */
|
||||
fill = (x2 >= x1) ? (x2 - x1) : 0;
|
||||
}
|
||||
else { /* | y1 - y2 | * maxX - x1 + x2 */
|
||||
fill = y1 - y2;
|
||||
if (fill < 0)
|
||||
fill += fill * 2;
|
||||
fill = fill * maxX - x1 + x2;
|
||||
/* (y2 - y1) * maxX - x1 + x2 */
|
||||
else if (y2 > y1) {
|
||||
fill = (y2 - y1) * maxX - x1 + x2;
|
||||
}
|
||||
else {
|
||||
fill = 0;
|
||||
}
|
||||
|
||||
FillConsoleOutputCharacterA(handle, ' ', fill, start, &w);
|
||||
|
|
|
|||
Loading…
Reference in New Issue