mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-05 04:50:57 +00:00
base32: Handle when char is unsigned
This commit is contained in:
parent
0afb53fba2
commit
2edd17ab54
8
base32.c
8
base32.c
@ -42,8 +42,12 @@ char *base32_encode(const uint8_t *in, size_t inlen, char *out, size_t outlen, c
|
|||||||
base32_encode_unsafe(in, inlen, (uint8_t *) out);
|
base32_encode_unsafe(in, inlen, (uint8_t *) out);
|
||||||
|
|
||||||
for (size_t i = 0; i < length; i++) {
|
for (size_t i = 0; i < length; i++) {
|
||||||
if ((out[i] = base32_encode_character(out[i], alphabet)) == -1) {
|
int ret = base32_encode_character(out[i], alphabet);
|
||||||
return NULL;
|
|
||||||
|
if (ret == -1) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
out[i] = ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user