strcpy_s() and strcat_s() aren't drop-in replacements for strlcpy() and strlcat()
This commit is contained in:

committed by
Love Hornquist Astrand

parent
6c45d5614a
commit
170e8158cb
@@ -49,4 +49,5 @@ strlcat (char *dst, const char *src, size_t dst_sz)
|
||||
|
||||
return len + strlcpy (dst + len, src, dst_sz - len);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -36,6 +36,20 @@
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
|
||||
ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
|
||||
strlcpy (char *dst, const char *src, size_t dst_cch)
|
||||
{
|
||||
errno_t e;
|
||||
|
||||
e = strcpy_s(dst, dst_cch, src);
|
||||
|
||||
return strlen (src);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
|
||||
strlcpy (char *dst, const char *src, size_t dst_sz)
|
||||
{
|
||||
@@ -54,3 +68,5 @@ strlcpy (char *dst, const char *src, size_t dst_sz)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user