6 ms·
It reads them both and concatenates them together into t1_buf_array with a call to strcat() — but without a bounds check! Oops. Things like this make me wonder
by userbinator 8y ago
It reads them both and concatenates them together into t1_buf_array with a call to strcat() — but without a bounds check! Oops.
Things like this make me wonder what was going through the mind of the programmer who wrote the code. I learned C less than a decade after it was invented, but the lack of implicit bounds-checking wasn't something I ever forgot. Perhaps it helps that I was using Asm before that. Of course then it was not thought of as a security thing, but just basic correctness.
It's such a simple concept --- make sure there's enough room --- and there is a concrete analogy to it in the real world --- that I continue to be disappointed and amazed at how many times someone manages to get it wrong. Then again, maybe it's just a bias: no one makes the news for doing it right.
- tlb 8y agoUntil recently, fonts were something that either came from the vendor, or which installed like software. So they weren't considered to be an exploitation vector, any more than installing any software is an vulnerability. It's only in the last several years with loadable web fonts that the font rendering code has needed armoring against malicious font files.
- rtpg 8y agoWell you have to _never make a mistake_ to not have issues. I know my phone won’t follow me magically out the door, I take it with me 99% of the time. I still leave it at home sometimes. Of course here the “chain my phone to my pants “ solution exists, in the form of linting rules preventing usage of unsafe APIs, and having a safer API that enforces checks (for example a strcat variant that requires reporting the destination container size). Or using checked string libraries instead of raw char*. Not 100% foolproof but could help things. The biggest difficulty is C’s abstraction ceiling being so low. Hard to do stuff like this without making code much bigger than it already is