2 ms·
I don't think it is fair to blame the language for this. Look at the lines above the vulnerability: n = n + i / (written_out + 1); i %= (written_out + 1);
by hedora 4y ago
I don't think it is fair to blame the language for this.
Look at the lines above the vulnerability:
n = n + i / (written_out + 1);
i %= (written_out + 1);
Whatever buffer manipulation this is doing could be abstracted out into a library. (As studio.h does.)
Also, since written_out probably varies from loop iteration to iteration, what does "n remainder i" even mean?
Also, why don't they increment written_out before doing the arithmetic, and why do they increment i on line 523, when the only intermediate use of it is "i + 1"?
I've written some crappy code in my time, but when things descended into that level of insanity, I either delegated to fuzz tested functions, or at least left a comment.