3 ms·
In my last school year, after three month doing security CTF, and for all my C projects since, i started bringing with the string its length and did everything
by orwin 6y ago
In my last school year, after three month doing security CTF, and for all my C projects since, i started bringing with the string its length and did everything i could to avoid using \0. I think almost all non-deprecated C stream function give you the string length (or bits received rather).
The reasons are multiple: its faster to use write() than printf() (and you don't have to flush to synchronize), its way harder to exploit, and easier to move around in different buffers. And i got to wrote my own string library during my project, and that was fun.