Skip to content

Commit

Permalink
Fix fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
apaillier-ledger committed Feb 25, 2025
1 parent df08dd2 commit 1def9f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/fuzzing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ include_directories(
${CMAKE_SOURCE_DIR}/../../src
${CMAKE_SOURCE_DIR}/../../src_features/generic_tx_parser/
${CMAKE_SOURCE_DIR}/../../src_features/provide_enum_value/
${CMAKE_SOURCE_DIR}/../../src_features/provideDynamicNetwork/
${CMAKE_SOURCE_DIR}/../../src_features/provide_network_info/
${CMAKE_SOURCE_DIR}/../../src_features/signTx/
${CMAKE_SOURCE_DIR}/../../src_features/provideTrustedName/
${CMAKE_SOURCE_DIR}/../../src_features/provide_trusted_name/
${CMAKE_SOURCE_DIR}/../../src_features/getChallenge/
${CMAKE_SOURCE_DIR}/../../src_features/signMessageEIP712/
${BOLOS_SDK}/include
Expand All @@ -196,10 +196,10 @@ include_directories(

FILE(GLOB_RECURSE SOURCES
${CMAKE_SOURCE_DIR}/../../src_features/generic_tx_parser/*.c
${CMAKE_SOURCE_DIR}/../../src_features/provideTrustedName/*.c
${CMAKE_SOURCE_DIR}/../../src_features/provide_trusted_name/*.c
${CMAKE_SOURCE_DIR}/../../src_features/getChallenge/*.c
${CMAKE_SOURCE_DIR}/../../src_features/provide_enum_value/*.c
${CMAKE_SOURCE_DIR}/../../src_features/provideDynamicNetwork/*.c
${CMAKE_SOURCE_DIR}/../../src_features/provide_network_info/*.c
${CMAKE_SOURCE_DIR}/../../src_features/provideNFTInformation/*.c
${CMAKE_SOURCE_DIR}/../../src/mem.c
${CMAKE_SOURCE_DIR}/../../src/mem_utils.c
Expand Down
9 changes: 5 additions & 4 deletions tests/fuzzing/src/fuzzer.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include <stdint.h>
#include <stdlib.h>

#include "network_dynamic.h"
#include "cmd_trusted_name.h"

#include "cmd_network_info.h"

#include "cmd_field.h"
#include "cmd_tx_info.h"
Expand Down Expand Up @@ -76,8 +78,7 @@ int fuzzDynamicNetworks(const uint8_t *data, size_t size) {
p2 = data[offset++];
len = data[offset++];
if (size - offset < len) return 0;
if (handleNetworkConfiguration(p1, p2, data + offset, len, &tx) != APDU_RESPONSE_OK)
return 1;
if (handle_network_info(p1, p2, data + offset, len, &tx) != APDU_RESPONSE_OK) return 1;
offset += len;
}
return 0;
Expand All @@ -93,7 +94,7 @@ int fuzzTrustedNames(const uint8_t *data, size_t size) {
p1 = data[offset++];
len = data[offset++];
if (size - offset < len) return 0;
if (handle_provide_trusted_name(p1, data + offset, len) != APDU_RESPONSE_OK) return 1;
if (handle_trusted_name(p1, data + offset, len) != APDU_RESPONSE_OK) return 1;
offset += len;
}
return 0;
Expand Down

0 comments on commit 1def9f1

Please sign in to comment.