[PATCH master 34/39] efi: loader: fix off-by-one in FAT codepage translation

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Feb 16 00:44:34 PST 2026


efi_fat_to_str() uses 'c > 0x80' to decide whether to apply codepage
translation, but character 0x80 (C-cedilla in CP437) also requires
translation. Use 'c >= 0x80' to include it.

Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 efi/loader/protocols/unicode_collation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/efi/loader/protocols/unicode_collation.c b/efi/loader/protocols/unicode_collation.c
index 4d9a26501723..9e522410fa2e 100644
--- a/efi/loader/protocols/unicode_collation.c
+++ b/efi/loader/protocols/unicode_collation.c
@@ -251,7 +251,7 @@ static void EFIAPI efi_fat_to_str(struct efi_unicode_collation_protocol *this,
 	EFI_ENTRY("%p, %zu, %s, %p", this, fat_size, fat, string);
 	for (i = 0; i < fat_size; ++i) {
 		c = (unsigned char)fat[i];
-		if (c > 0x80)
+		if (c >= 0x80)
 			c = codepage[c - 0x60];
 		string[i] = c;
 		if (!c)
-- 
2.47.3




More information about the barebox mailing list