mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
sanity check on return value
This commit is contained in:
@ -15631,17 +15631,22 @@ int sp_todecimal(sp_int* a, char* str)
|
||||
|
||||
i = 0;
|
||||
while (!sp_iszero(t)) {
|
||||
sp_div_d(t, 10, t, &d);
|
||||
err = sp_div_d(t, 10, t, &d);
|
||||
if (err != MP_OKAY) {
|
||||
break;
|
||||
}
|
||||
str[i++] = (char)('0' + d);
|
||||
}
|
||||
str[i] = '\0';
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
for (j = 0; j <= (i - 1) / 2; j++) {
|
||||
int c = (unsigned char)str[j];
|
||||
str[j] = str[i - 1 - j];
|
||||
str[i - 1 - j] = (char)c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FREE_SP_INT(t, NULL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user