[1]: https://github.com/sudo-project/sudo/commit/0274a4f3b403162a...
It has one job
* read file as priviledged user * copy it to temporary file * run editor as unpriviledged user * copy the changed file back
The fact lack of escaping somehow makes sudoedit try to edit file passed in EDITOR variable is extremely shoddy coding.
edit: apparently things are more complex and sudoedit already runs the command unprivileged; the attack is in filename expansion in sudoedit itself.
A system with more of an object capabilities model could have helped, though. The goal wasn't really "let the user run their editor as root (when they ask for it)", but "let the user work with this particular file from their editor (when they ask for it)".
Not to mention, C++ /can/ be memory safe if you use memory-safe routines.
I'm just waiting for articles to come in, this year.. "why 2023 was not the year of Rust". Not hating on Rust - just the evangelism.