Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> OTOH, if an incoming string doesn't have a NUL byte your program will crash/corrupt memory/worse.

how are linked lists different? if the last node contains garbage for its next pointer, the outcome will be exactly the same. it's a bit more rare to encounter an "unterminated" linked list, but I've seen it happen plenty of times deserializing a linked list from disk or if the programmer just forgot to initialize the pointer. c strings basically are linked lists with an implicit next pointer.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: