Files
Kaj SchittecatandClaude Opus 5 d192bf53db fix: never trust a translation as a printf format string (#258)
pisti87's T-Deck rebooted every time he logged into a repeater, but only in
Hungarian. The login clock-skew warning does:

  snprintf(msg, n, TR("Device clock differs from \"%s\" by %lu min%s"),
           name, minutes, suffix);

and the Hungarian row reordered the conversions to "%lu ... %s ... %s". Varargs
are positional, so snprintf read the name POINTER as an unsigned long and then
took the minute count -- the integer 3 -- as a char* and dereferenced address 3.
Instant panic, every login, Hungarian only. English fit the declared order, so
it never showed there.

Fixing the four bad Hungarian rows is not sufficient: TR() returns a format
string and translations come from .lang files that users download or hand-write,
so any file can crash any device. TR() now compares the ordered conversion
signatures of key and translation and falls back to the English key on a
mismatch -- the key IS the call site's format string, so it is always correct.
The scan runs only for keys containing '%', which is a small minority.

Also fixed the four rows (three were Hungarian-only crashes or dropped values),
bumped hu to v11, and taught audit-lang.py to fail the build on a mismatch so a
future translation PR cannot reintroduce this. Unit-checked that the audit
detects the original bad row and accepts the repaired one.

Reported by pisti87.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-12 08:14:05 +02:00

16 lines
649 B
JSON

{"langs":[
{"code":"bg","name":"Български","ver":"8"},
{"code":"de","name":"Deutsch","ver":"9"},
{"code":"el","name":"Ελληνικά","ver":"8"},
{"code":"es","name":"Español","ver":"8"},
{"code":"fr","name":"Français","ver":"8"},
{"code":"hu","name":"Magyar","ver":"11"},
{"code":"it","name":"Italiano","ver":"8"},
{"code":"nl","name":"Nederlands","ver":"9"},
{"code":"pt-br","name":"Português (BR)","ver":"8"},
{"code":"ro","name":"Română","ver":"8"},
{"code":"ru","name":"Русский","ver":"8"},
{"code":"sr","name":"Српски","ver":"8"},
{"code":"uk","name":"Українська","ver":"8"}
]}