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

A great tweet, and often useful. But I don't think it applies well here.

There is a long history of "this time, the strcpy replacement will be safe" followed by cve after cve after cve. At some point I feel that the response really should be to give up on trying to make c-style strings safe.



The problem is the function signatures of all the improved string functions are broken. You can never write a safe string function that takes two char pointers.

You really want

  int str_try_copy(str_buffer *dest, str_slice *src)


You are more than welcome to give up on it. Personally I feel that you can never make code that handles C strings secure. That said, people will still be using them decades from now, and it is possible to give them safer APIs. Discounting everything as "oh it can never be perfect therefore we might as well throw away any efforts to make it better" is not helpful.




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

Search: