From f91049d5d7d7dc25b574c57236932280a83f79ba Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 2 Jul 2017 02:09:06 -0700 Subject: [PATCH] strxcpyx: assert throughout on non-NULL src/dest --- src/basic/strxcpyx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/basic/strxcpyx.c b/src/basic/strxcpyx.c index 5e20984..c6fbe79 100644 --- a/src/basic/strxcpyx.c +++ b/src/basic/strxcpyx.c @@ -37,6 +37,9 @@ size_t strpcpy(char **dest, size_t size, const char *src) { size_t len; + assert(dest); + assert(src); + if (size == 0) return 0; @@ -59,6 +62,9 @@ size_t strpcpyf(char **dest, size_t size, const char *src, ...) { va_list va; int i; + assert(dest); + assert(src); + if (size == 0) return 0; @@ -77,6 +83,9 @@ size_t strpcpyf(char **dest, size_t size, const char *src, ...) { size_t strpcpyl(char **dest, size_t size, const char *src, ...) { va_list va; + assert(dest); + assert(src); + va_start(va, src); do { size = strpcpy(dest, size, src); @@ -89,6 +98,9 @@ size_t strpcpyl(char **dest, size_t size, const char *src, ...) { size_t strscpy(char *dest, size_t size, const char *src) { char *s; + assert(dest); + assert(src); + s = dest; return strpcpy(&s, size, src); } @@ -97,6 +109,9 @@ size_t strscpyl(char *dest, size_t size, const char *src, ...) { va_list va; char *s; + assert(dest); + assert(src); + va_start(va, src); s = dest; do { -- 2.7.4