Skip to content

Commit

Permalink
fix: Apped zeros when converting mpz to string
Browse files Browse the repository at this point in the history
  • Loading branch information
TejasvOnly committed Jan 9, 2025
1 parent 44a4e78 commit 41d8d78
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions apps/starknet_app/starknet_pub_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,21 @@ void starknet_get_pub_keys(starknet_query_t *query) {
if (STARKNET_QUERY_GET_USER_VERIFIED_PUBLIC_KEY_TAG == which_request) {
char address[100] = "0x";

// Calculate to-be account address
starknet_derive_argent_address(&public_keys[0][0], &address[2]);
{
char raw_address[100] = {0};
// Calculate to-be account address
starknet_derive_argent_address(&public_keys[0][0], raw_address);

size_t len = 64 - strnlen(raw_address, sizeof(raw_address));
if (len < 0) {
len = 0;
}
uint8_t index = 2;
while (len--) {
sprintf(address + index++, "0");
}
snprintf(address + index, sizeof(address) - index, raw_address);
}

if (!core_scroll_page(ui_text_receive_on, address, starknet_send_error)) {
return;
Expand All @@ -537,4 +550,4 @@ void starknet_get_pub_keys(starknet_query_t *query) {
}

delay_scr_init(ui_text_check_cysync_app, DELAY_TIME);
}
}

0 comments on commit 41d8d78

Please sign in to comment.