Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some issues #225

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=2
# This is the minor version of this release
APPVERSION_N=4
# This is the patch version of this release
APPVERSION_P=8
APPVERSION_P=9
3 changes: 3 additions & 0 deletions app/src/candid/nns_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ __Z_INLINE parser_error_t readCommandSpawn(parser_context_t *ctx, candid_transac
CHECK_PARSER_ERR(readCandidByte(ctx, &has_principal))
if (has_principal) {
CHECK_PARSER_ERR(readCandidByte(ctx, &val->command.spawn.new_controller.len))
if (val->command.spawn.new_controller.len > DFINITY_PRINCIPAL_LEN) {
return parser_unexpected_value;
}
CHECK_PARSER_ERR(readCandidBytes(ctx, val->command.spawn.new_controller.ptr, val->command.spawn.new_controller.len))
}
}
Expand Down
9 changes: 7 additions & 2 deletions app/src/parser_print_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ parser_error_t page_principal_with_subaccount(const uint8_t *sender, uint16_t se
uint16_t principalLen = sizeof(text);
zxerr_t err = zxerr_unknown;
err = crypto_principalToTextual(sender, senderLen, text_ptr, &principalLen);
// maximum length without separators is 53
if (err != zxerr_ok || principalLen > 53) {
return parser_unexpected_error;
}
const uint8_t principalTextLen = (uint8_t)(principalLen + principalLen / 6);
// every 5 chars there's a separator, and last block has no separator after it
const uint8_t principalTextLen = (uint8_t)(principalLen + principalLen / 5 - (principalLen % 5 ? 0 : 1));
for (uint8_t i = 5; i < principalTextLen; i += 6) {
// two blocks separated with dash, 3rd with SEPARATOR
if ((i + 1) % 18 == 0) err = inplace_insert_char(text_ptr, sizeof(text), i, SEPARATOR); // line break
Expand All @@ -176,8 +178,11 @@ parser_error_t page_principal_with_subaccount(const uint8_t *sender, uint16_t se
return parser_unexpected_error;
}
}
// we are sure it's going to be up to 63
// we are sure it's going to be up to 63 (53 + 10)
principalLen = (uint16_t)strnlen(text, sizeof(text));
if (principalLen > 63) {
return parser_unexpected_value;
}
*(text_ptr + principalLen) = '-';
text_ptr += principalLen + 1;

Expand Down
2 changes: 1 addition & 1 deletion deps/nanos-secure-sdk
Submodule nanos-secure-sdk updated 191 files
2 changes: 1 addition & 1 deletion deps/nanosplus-secure-sdk
2 changes: 1 addition & 1 deletion deps/nanox-secure-sdk
Submodule nanox-secure-sdk updated 293 files
2 changes: 1 addition & 1 deletion deps/stax-secure-sdk
Submodule stax-secure-sdk updated 280 files
Binary file modified tests_zemu/snapshots/s-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/s-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/st-mainmenu/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading