Re:Checked C: extension to C that adds static and dynamic ch...
by _RPM on Wednesday March 14, 2018 @09:35PM
(#16589901)
strcpy has no access to the "allocator". It doesn't know about malloc, realloc, or free.
[ Parent
| on HN ]
Re:Checked C: extension to C that adds static and dynamic ch...
by iainmerrick on Thursday March 15, 2018 @04:07AM
(#16591123)
Yes -- and that has turned out to be a bad design decision. It's somewhat convenient to use methods like strcat() to build up strings, but it also leads to very insecure code.
I think the inclusion of strdup() shows that it was a mistake to make C strings completely allocator-agnostic.