tfm and integer: skip whitespace at end in radix read

This commit is contained in:
Juliusz Sosinowicz
2024-02-02 14:38:40 +01:00
parent 7ebb8cd007
commit be90fe073e
2 changed files with 10 additions and 1 deletions

View File

@ -5358,6 +5358,9 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
++str;
}
/* Skip whitespace at end of str */
while (CharIsWhiteSpace(*str))
++str;
/* if digit in isn't null term, then invalid character was found */
if (*str != '\0') {
mp_zero (a);

View File

@ -6029,7 +6029,13 @@ static int fp_read_radix(fp_int *a, const char *str, int radix)
}
}
if (y >= radix) {
return FP_VAL;
/* Check if whitespace at end of line */
while (CharIsWhiteSpace(*str))
++str;
if (*str)
return FP_VAL;
else
break;
}
/* if the char was found in the map