What changed, and why it matters
This commit is a maintenance change to the Trezor firmware's embedded printf library. It adds source attribution comments, unconditionally includes a configuration header, and adds a compile-time guard that blocks printf from being used in production firmware builds. There is no direct evidence in the commit of a security vulnerability being fixed.
No immediate security action required. Review printf_config.h to confirm it disables unsupported format specifiers and sets safe buffer limits. Treat this as a hardening/build-hygiene commit rather than a vulnerability fix.
Security signals we found
Compile-time guard added to prevent printf use in production firmware/bootloader/boardloader
Unconditional inclusion of printf_config.h may expose or enforce project-specific hardening settings
No patch to format-string parsing, buffer sizing, or output path
Evidence from the diff
The patch modifies core/embed/rtl/printf.c and core/embed/rtl/inc/printf/printf.h. Changes: (1) adds ‘clang-format off’ and a source URL pointing to eyalroz/printf v6.3.0; (2) removes the conditional PRINTF_INCLUDE_CONFIG_H guard so printf_config.h is always included; (3) adds a #error directive preventing compilation when PRODUCTION is defined and TREZOR_PRODTEST is not. No functional printf code, format-string handling, or buffer logic is changed. The diff is purely build/attribution adaptation.
Changed components
core/embed/rtl/printf.ccore/embed/rtl/inc/printf/printf.hInspect captured patch +14 / −4
diff --git a/core/embed/rtl/inc/printf/printf.h b/core/embed/rtl/inc/printf/printf.h
index 87715ed51..13e0585b9 100644
--- a/core/embed/rtl/inc/printf/printf.h
+++ b/core/embed/rtl/inc/printf/printf.h
@@ -1,3 +1,6 @@
+// clang-format off
+// source: https://github.com/eyalroz/printf/blob/v6.3.0/src/printf/printf.h
+
/**
* @author (c) Eyal Rozenberg <eyalroz1@gmx.com>
* 2021-2024, Haifa, Palestine/Israel
@@ -39,9 +42,9 @@
#ifndef PRINTF_H_
#define PRINTF_H_
-#ifdef PRINTF_INCLUDE_CONFIG_H
+//#ifdef PRINTF_INCLUDE_CONFIG_H
#include "printf_config.h"
-#endif
+//#endif
#ifdef __cplusplus
# include <cstdarg>
diff --git a/core/embed/rtl/printf.c b/core/embed/rtl/printf.c
index 52c1a951f..0fa9319a8 100644
--- a/core/embed/rtl/printf.c
+++ b/core/embed/rtl/printf.c
@@ -1,3 +1,6 @@
+// clang-format off
+// source: https://github.com/eyalroz/printf/blob/v6.3.0/src/printf/printf.c
+
/**
* @author (c) Eyal Rozenberg <eyalroz1@gmx.com>
* 2021-2024, Haifa, Palestine/Israel
@@ -37,13 +40,17 @@
* THE SOFTWARE.
*/
+#if PRODUCTION && !defined(TREZOR_PRODTEST)
+#error Avoid using printf in production firmware/bootloader/boardloader
+#endif
+
/*
* Define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H=1 ...) to include the
* printf_config.h header file
*/
-#if PRINTF_INCLUDE_CONFIG_H
+//#if PRINTF_INCLUDE_CONFIG_H
#include "printf_config.h"
-#endif
+//#endif
#include <printf/printf.h>
Why this scored 11/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.