Allowing for message signature the line feed (LF) character handled by NBGL
What changed, and why it matters
This commit changes how the Ledger Bitcoin app decides whether a message being signed is 'printable' on the device screen. It now allows the Line Feed (newline) character to pass through, because the newer NBGL screen library can display multi-line text. Previously, any character outside the normal visible ASCII range would make the message be shown as a hex dump instead of readable text. The change is a small UI/UX improvement for message signing and does not appear to alter the actual cryptographic signature.
No immediate action required. Treat as a routine UI compatibility update. If reviewing for security, verify that the newline exception cannot be abused to mislead users (e.g., by truncating or visually splitting a message in a deceptive way), and confirm that the message hash/signature path is independent of the printable flag.
Security signals we found
UI display validation relaxation
Non-printable ASCII character exception added
No cryptographic code changed
Evidence from the diff
In src/handler/sign_message.c, the loop that validates each byte of a message chunk for display purposes previously marked the message as non-printable if any byte was outside 0x20-0x7E. The patch adds an exception for the newline character (0x0A/’\n’), because the NBGL UI framework can render line breaks. The signature path itself is unchanged; this only affects how the message is presented to the user for approval on the device screen.
Changed components
src/handler/sign_message.cmessage signing display flowInspect captured patch +3 / −1
diff --git a/src/handler/sign_message.c b/src/handler/sign_message.c
index acf8a24..159f9a4 100644
--- a/src/handler/sign_message.c
+++ b/src/handler/sign_message.c
@@ -104,7 +104,9 @@ void handler_sign_message(dispatcher_context_t *dc, uint8_t protocol_version) {
if (printable) {
for (int j = 0; j < chunk_len; j++) {
- if (message_chunk[j] < 0x20 || message_chunk[j] > 0x7E) {
+ // Line Feed (LF) character is handled by NBGL - let's allow it
+ if ((message_chunk[j] < 0x20 || message_chunk[j] > 0x7E) &&
+ (message_chunk[j] != '\n')) {
printable = false;
break;
}
Why this scored 20/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.