3 ms·
The reality is that both strcpy and strlcpy require the person using the API to use it correctly in order to not end up with a buggy program; but, in the real w
by saurik 13y ago
The reality is that both strcpy and strlcpy require the person using the API to use it correctly in order to not end up with a buggy program; but, in the real world, people hype strlcpy as being fundamentally safer than strcpy, and so if you actually look into how people use strlcpy no one ever checks its return value (even projects like OpenSSH).
For more on this (and a specific ludicrous example from OpenSSH where someone spent the time to write a comment above the strlcpy about truncation and yet still didn't actually bother to check the return value of the function), please see this response I made to someone else:
https://news.ycombinator.com/item?id=6940724 https://news.ycombinator.com/item?id=6940724