Red Echo

January 20, 2012

Strange to think that string-copying functions are still a subject of active debate in 2012, but here’s a clearly-written, well-thought-out survey of the current options and a proposed solution to their various buffer-overrun risks and performance constraints:

This is a look at the various means in C to copy strings, and their safety and performance implications. What is surprising is that all of the available implementations, even the venerable *BSD strl functions have serious issues.

To preface, I am only going to cover null-terminated strings, because that is what the libc runtime, which is the foundation that every language ultimately reaches down to in the end, is built around.

I will also cover a new proposed alternative to address the problems I’ve mentioned at the end of this article.