1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: validate i before underflow

Although it can't happen in this code, ensure 'i' is not 0
before decrementing it.
This commit is contained in:
Zdenek Kabelac 2024-03-28 23:14:29 +01:00
parent fef49a0e86
commit 960df88621

View File

@ -999,7 +999,8 @@ char yes_no_prompt(const char *prompt, ...)
answer = _no + 1; /* Expecting 'No' */
} else if (!ret && isspace(c)) {
/* Ignore any whitespace before */
--i;
if (i > 0)
i--;
goto nextchar;
} else if ((ret > 0) && answer && isspace(c)) {
/* Ignore any whitespace after */