Now initializes a path in memory

This commit is contained in:
Alexandre Paillier
2022-05-02 15:30:26 +02:00
parent 7e35b96ec0
commit 0e386a4204
6 changed files with 51 additions and 2 deletions

View File

@@ -60,6 +60,10 @@ void *encode_integer(const uint8_t *const value, uint16_t length)
{
uint8_t *padded_value;
if (length > 32) // sanity check
{
return NULL;
}
// 0-pad the value to 32 bytes
if ((padded_value = mem_alloc(EIP_712_ENCODED_FIELD_LENGTH)) != NULL)
{
@@ -93,7 +97,7 @@ void *encode_string(const char *const value, uint16_t length)
*/
void *encode_bool(const bool *const value, uint16_t length)
{
if (length != 1)
if (length != 1) // sanity check
{
return NULL;
}
@@ -109,7 +113,7 @@ void *encode_bool(const bool *const value, uint16_t length)
*/
void *encode_address(const uint8_t *const value, uint16_t length)
{
if (length != ADDRESS_LENGTH)
if (length != ADDRESS_LENGTH) // sanity check
{
return NULL;
}