Skip to content

Commit

Permalink
Fix: replace memcpy with strncpy
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed Feb 28, 2024
1 parent 8680f10 commit 490f4bd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/monero_ux_nano.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,21 +606,21 @@ int ui_menu_any_pubaddr_display(unsigned int value __attribute__((unused)), unsi
switch (G_monero_vstate.disp_addr_mode) {
case 0:
case DISP_MAIN:
memcpy(ADDR_TYPE, "Main", 4);
memcpy(ADDR_MAJOR, "Major: 0", 8);
memcpy(ADDR_MINOR, "minor: 0", 8);
memcpy(ADDR_TYPE, "Main", sizeof("Main"));
memcpy(ADDR_MAJOR, "Major: 0", sizeof("Major: 0"));
memcpy(ADDR_MINOR, "minor: 0", sizeof("minor: 0"));
break;

case DISP_SUB:
memcpy(ADDR_TYPE, "Sub", 3);
memcpy(ADDR_TYPE, "Sub", sizeof("Sub"));
snprintf(ADDR_MAJOR, 16, "Major: %d", G_monero_vstate.disp_addr_M);
snprintf(ADDR_MINOR, 16, "minor: %d", G_monero_vstate.disp_addr_m);
break;

case DISP_INTEGRATED:
memcpy(ADDR_TYPE, "Integrated", 10);
memcpy(ADDR_IDSTR, "Payment ID", 10);
memcpy(ADDR_ID, G_monero_vstate.payment_id, 16);
memcpy(ADDR_TYPE, "Integrated", sizeof("Integrated"));
memcpy(ADDR_IDSTR, "Payment ID", sizeof("Payment ID"));
strncpy(ADDR_ID, G_monero_vstate.payment_id, 16);
break;
}

Expand Down

0 comments on commit 490f4bd

Please sign in to comment.