ensure string is null-terminated
This commit is contained in:
parent
71e3024f30
commit
ba95ef76e0
@ -72,6 +72,12 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
|
|||||||
++str;
|
++str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if an illegal character was found, fail. */
|
||||||
|
if (*str != '\0') {
|
||||||
|
mp_zero(a);
|
||||||
|
return MP_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* set the sign only if a != 0 */
|
/* set the sign only if a != 0 */
|
||||||
if (mp_iszero(a) != MP_YES) {
|
if (mp_iszero(a) != MP_YES) {
|
||||||
a->sign = neg;
|
a->sign = neg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user