The assumption of NUL-terminated strings is actually quite a good one in most cases. You don't have to worry about paths, because they may not contain NUL. Same applies to arguments passed to you. Unless you have to unescape, there is no way for you to receive a NUL. There are two important exceptions though, and it's important that we address them, or else we get unexpected behaviour: 1) All tools using unescape() have to be strict about delimlen. Else they end up for instance unescaping '\\0abc' to '\0abc', which in C's string-vision is an empty string. 2) All tools doing line wrenching and putting them out again as lines again. puts() will cut each line containing NULs off at the first occurence.
3.7 KiB
3.7 KiB