eosnetworkfoundation / ledger-app

EOS app for ledger devices
Apache License 2.0
1 stars 0 forks source link

Consistent Usage 2 main.com #11

Closed ericpassmore closed 2 years ago

ericpassmore commented 2 years ago

src/main.c:196:10: warning: passing 'volatile char [32]' to parameter of type 'char ' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] strcpy(confirmLabel, (N_storage.dataAllowed ? "Allowed" : "NOT Allowed")); ^~~~ /usr/arm-none-eabi/include/string.h:38:32: note: passing argument to parameter here char strcpy (char __restrict, const char __restrict);

ericpassmore commented 2 years ago

Fix by casting to char *. Earlier confirmLabel is defined as volatile char confirmLabel[32]. So this cast will resolve the compiler warning.

strcpy((char *) confirmLable,  (N_storage.dataAllowed ? "Allowed" : "NOT Allowed"));

In addition strcpy isn't secure so we should use strlcpy

strlcpy((char *) confirmLable,  (N_storage.dataAllowed ? "Allowed" : "NOT Allowed"),32);