You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of my ongoing efforts to remove code that isn't needed or problematic I recently noticed strcopy(). It's used in only 24 places and all of those should be using strlcpy() or an other appropriate function. The function is also unsafe for the same reasons that strcpy() is unsafe. There is no good reason to retain strcopy() so nuke it.
The text was updated successfully, but these errors were encountered:
Please note that this isn't about removing libast code just because it can be replaced with an alternative. It's about reducing the amount of complexity in the project. It's about reducing the number of patterns or interfaces someone has to be aware of when reading the code. It's about eliminating code that is almost certain to be slower than an equivalent API provided by the platform.
I'm going to resolve this in two steps. First, mechanically replace strcopy() with stpcpy() since they are equivalent. There are a handful of uses of stpcpy() that also need to be replaced by strlcpy(). Then replace stpcpy() with strlcpy().
I'm closing this because issue #956 is already open which notes that uses of stpcpy() should be replaced with strlcpy(). The problem is that the existing code makes that substitution pointless since it would involve pretending that the target buffer is of length SIZE_T_MAX. In other words, the existing data structures make it all but impossible to ensure that problems like buffer overruns can't happen. Fixing this state of affairs is going to be non-trivial.
As part of my ongoing efforts to remove code that isn't needed or problematic I recently noticed
strcopy()
. It's used in only 24 places and all of those should be usingstrlcpy()
or an other appropriate function. The function is also unsafe for the same reasons thatstrcpy()
is unsafe. There is no good reason to retainstrcopy()
so nuke it.The text was updated successfully, but these errors were encountered: