After inspecting a few of the calltraces, it seems like even though the input is always a C string, `maxlen` is meant to always be smaller than `strlen(str)`. Which would make the original vim code the most correct and performant variant. How about we document this better and go for the original vim code, and keep `memcpy`?