Windows: Don't attempt to copy a string to a zero length buffer
It won't cause harm since strcpy_s() deals with zero length buffers, but it invokes the invalid parameter handler, which can disrupt execution on debug builds.
This commit is contained in:

committed by
Asanka C. Herath

parent
d4fc674024
commit
7479c855a0
@@ -43,7 +43,8 @@ strlcpy (char *dst, const char *src, size_t dst_cch)
|
|||||||
{
|
{
|
||||||
errno_t e;
|
errno_t e;
|
||||||
|
|
||||||
e = strcpy_s(dst, dst_cch, src);
|
if (dst_cch > 0)
|
||||||
|
e = strncpy_s(dst, dst_cch, src, _TRUNCATE);
|
||||||
|
|
||||||
return strlen (src);
|
return strlen (src);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user