3 ms·
The author should've been wary of strncpy, because his solution is wrong. "If there is no null byte among the first n bytes of src, the string placed in dest w
by bio_end_io_t 8y ago
The author should've been wary of strncpy, because his solution is wrong.
"If there is no null byte among the first n bytes of src, the string placed in dest will not be null-terminated."
So copying sizeof(dest)-1 will not append a NULL byte as the author implies. You'll have to do that manually.
- mturmon 8y agoArticle's solution is wrong, but at least the headline is right!