Messages in this thread | | | From | Rickard Strandqvist <> | Subject | [PATCH v2] lib: string.c: Added a funktion function strzcpy | Date | Sun, 5 Oct 2014 15:06:16 +0200 |
| |
I've added a strzcpy to make it easier to not do wrong when you use the function strncpy.
Often one needs the zero padding, but must still have a guaranteed zero character terminat. Then you end up writing code like this: strncpy(to, src, sizeof(to)); to[sizeof(to) - 1] = '\0';
This is solved with strzcpy.
Rickard Strandqvist (1): lib: string.c: Added a funktion function strzcpy
include/linux/string.h | 1 + lib/string.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
-- 1.7.10.4
| |