CLI: validate_int: just fail if length > 9

This commit is contained in:
gitlost 2021-02-06 00:18:00 +00:00
parent 6274140c73
commit 5d4fe0b572

View File

@ -207,7 +207,7 @@ static int validate_int(const char source[], int *p_val) {
int length = (int) strlen(source); int length = (int) strlen(source);
if (length > 9) { /* Prevent overflow */ if (length > 9) { /* Prevent overflow */
length = 9; return 0;
} }
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
if (source[i] < '0' || source[i] > '9') { if (source[i] < '0' || source[i] > '9') {