News for hackers. Stuff that matters.
Re:Glibc's strlen implementation: Probably not what you'd guess by gjm11 on Tuesday March 10, 2009 @04:49PM (#510624)
The glibc strlen begins by checking the first few bytes, if necessary, so that it can continue with the assumption that the string is 4-byte or 8-byte aligned. So no, it's not horribly broken: all the reads are aligned, and you're not going to get a page boundary in the middle of the word.

(Also, you're not going to be reading off the end of a malloc'ed block, because essentially all malloc implementations, including the one in glibc, return blocks whose start address and size are multiples of the architecture's word size.)

There are no comments on this comment yet.