Skip to content

Commit 97f17b2

Browse files
Merge pull request #510 from LedgerHQ/fix/apa/standard_plugin_variant
Fix standard plugin variant + null-check on parameters
2 parents 0c263ca + cce3852 commit 97f17b2

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

src_plugin_sdk/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
| :rotating_light: | Breaks build |
66
| :warning: | Breaks compatibility with app |
77

8-
## [latest](/) - 2023/12/06
8+
## [latest](/) - 2023/12/07
99

1010
### Fixed
1111

1212
* standard\_plugin build ([this PR on the SDK](https://github.com/LedgerHQ/ledger-secure-sdk/pull/473) had broken it)
13+
* Broken variant auto-setting in the standard\_plugin Makefile
14+
* Missing null-check on parameters received by the plugins
1315

1416
### Changed
1517

src_plugin_sdk/main.c

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,32 @@ static void call_app_ethereum() {
5353

5454
// Function to dispatch calls from the ethereum app.
5555
static void dispatch_call(int message, void *parameters) {
56-
switch (message) {
57-
case ETH_PLUGIN_INIT_CONTRACT:
58-
handle_init_contract(parameters);
59-
break;
60-
case ETH_PLUGIN_PROVIDE_PARAMETER:
61-
handle_provide_parameter(parameters);
62-
break;
63-
case ETH_PLUGIN_FINALIZE:
64-
handle_finalize(parameters);
65-
break;
66-
case ETH_PLUGIN_PROVIDE_INFO:
67-
handle_provide_token(parameters);
68-
break;
69-
case ETH_PLUGIN_QUERY_CONTRACT_ID:
70-
handle_query_contract_id(parameters);
71-
break;
72-
case ETH_PLUGIN_QUERY_CONTRACT_UI:
73-
handle_query_contract_ui(parameters);
74-
break;
75-
default:
76-
PRINTF("Unhandled message %d\n", message);
77-
break;
56+
if (parameters != NULL) {
57+
switch (message) {
58+
case ETH_PLUGIN_INIT_CONTRACT:
59+
handle_init_contract(parameters);
60+
break;
61+
case ETH_PLUGIN_PROVIDE_PARAMETER:
62+
handle_provide_parameter(parameters);
63+
break;
64+
case ETH_PLUGIN_FINALIZE:
65+
handle_finalize(parameters);
66+
break;
67+
case ETH_PLUGIN_PROVIDE_INFO:
68+
handle_provide_token(parameters);
69+
break;
70+
case ETH_PLUGIN_QUERY_CONTRACT_ID:
71+
handle_query_contract_id(parameters);
72+
break;
73+
case ETH_PLUGIN_QUERY_CONTRACT_UI:
74+
handle_query_contract_ui(parameters);
75+
break;
76+
default:
77+
PRINTF("Unhandled message %d\n", message);
78+
break;
79+
}
80+
} else {
81+
PRINTF("Received null parameters\n");
7882
}
7983
}
8084

src_plugin_sdk/standard_plugin.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ CURVE_APP_LOAD_PARAMS = secp256k1
4848
PATH_APP_LOAD_PARAMS ?= "44'/60'"
4949

5050
VARIANT_PARAM = COIN
51-
VARIANTS_VALUES ?= $(NORMAL_NAME)
51+
VARIANT_VALUES ?= $(NORMAL_NAME)
5252

5353
HAVE_APPLICATION_FLAG_LIBRARY = 1
5454

0 commit comments

Comments
 (0)