Skip to content

Commit

Permalink
rpc: don't check for negative lengths, size_t is unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
jgriffiths committed Jan 20, 2025
1 parent d5233ef commit 0dd55ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main/process/get_blinding_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void get_blinding_key_process(void* process_ptr)
size_t script_len = 0;
const uint8_t* script = NULL;
rpc_get_bytes_ptr("script", &params, &script, &script_len);
if (!script || script_len <= 0) {
if (!script || !script_len) {
jade_process_reject_message(process, CBOR_RPC_BAD_PARAMETERS, "Failed to extract script from parameters", NULL);
goto cleanup;
}
Expand Down
2 changes: 1 addition & 1 deletion main/process/get_shared_nonce.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void get_shared_nonce_process(void* process_ptr)
size_t script_len = 0;
const uint8_t* script = NULL;
rpc_get_bytes_ptr("script", &params, &script, &script_len);
if (!script || script_len <= 0) {
if (!script || !script_len) {
jade_process_reject_message(process, CBOR_RPC_BAD_PARAMETERS, "Failed to extract script from parameters", NULL);
goto cleanup;
}
Expand Down

0 comments on commit 0dd55ac

Please sign in to comment.