Skip to content

Commit 0a8b742

Browse files
committed
Limit max string length snprintf
1 parent 2edf8d8 commit 0a8b742

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static void logAppVersion(const esp_partition_t *partition) {
8181
char hash_print[HASH_LEN * 2 + 1];
8282
hash_print[HASH_LEN * 2] = 0;
8383
for (int i = 0; i < HASH_LEN; ++i) {
84-
sprintf(&hash_print[i * 2], "%02x", app_desc.app_elf_sha256[i]);
84+
snprintf(&hash_print[i * 2], 3, "%02x", app_desc.app_elf_sha256[i]);
8585
}
8686
ESP_LOGI(TAG, "App '%s', Version: '%s'", app_desc.project_name, app_desc.version);
8787
ESP_LOGI(TAG, "IDF-Version: '%s'", app_desc.idf_ver);

0 commit comments

Comments
 (0)