diff --git a/ports/stm32/boards/Passport/tools/cosign/cosign.c b/ports/stm32/boards/Passport/tools/cosign/cosign.c index 831d8c1..688808b 100644 --- a/ports/stm32/boards/Passport/tools/cosign/cosign.c +++ b/ports/stm32/boards/Passport/tools/cosign/cosign.c @@ -24,6 +24,10 @@ #include "uECC.h" #endif /* USE_CRYPTO */ +// This is the maximum length of "-key" + "-user", "00", "01", "02", or "03" +// Also, + 1 for the folder "/" +#define KEY_NAME_MAX_LENGTH 15 + static char *firmware; static char *version; static bool help; @@ -500,7 +504,7 @@ static void sign_firmware( return; } - output = (char *)calloc(1, strlen(path) + 1 + strlen(final_file) + 14); + output = (char *)calloc(1, strlen(path) + strlen(final_file) + KEY_NAME_MAX_LENGTH); if (output == NULL) { printf("insufficient memory (output)\n");