This nasty printf()-like way of formatting is a giant footgun though. Apple are not the first ones to fall into this trap.
I'll admit I looked around before writing this and saw that Python's str.format() can be pretty bad. So let's say a reasonably constrained formatting language in a good runtime -- the attacker is limited in what they can see or control, and the formatter can see how many arguments were actually passed so it doesn't tromp off into other memory.
Sorry, how does Rust protect you against injection again?
https://play.rust-lang.org/?version=stable&mode=debug&editio...
edit: turns out from the analysis it was CFStringCreateWithFormatAndArguments, so yes, a sprintf-like used incorrectly
https://play.rust-lang.org/?version=stable&mode=debug&editio...