Security review (#331)

* Fix some issues

* add typed_data.c changes

* Make attribution after the check
This commit is contained in:
Jorge Martins
2022-08-08 13:53:41 +02:00
committed by GitHub
parent ff68de5bb7
commit b2ec3eff0a
7 changed files with 43 additions and 4 deletions

View File

@@ -74,6 +74,11 @@ void *encode_uint(const uint8_t *const value, uint8_t length) {
void *encode_int(const uint8_t *const value, uint8_t length, uint8_t typesize) {
uint8_t padding_value;
if (length < 1) {
apdu_response_code = APDU_RESPONSE_INVALID_DATA;
return NULL;
}
if ((length == typesize) && (value[0] & (1 << 7))) // negative number
{
padding_value = 0xFF;