I give up. It's got as many eyeballs in it as you could ever hope, and it's as mature as any piece of software ever could be. And its job is to write text to files. It's basically a wrapper around printf. How did this get screwed up? Security is impossible.
The only winning move is not to code!
....OR learn to live in a state of constant vulns and put guardrails in place so that you can avoid shooting yourself in the foot as much as possible. In this case strict ngress/egress firewall rules in prod would prevent this from ever being exploited from what I've read on the vuln thus far.