Commit 72d45525 authored by Wayne Davison's avatar Wayne Davison

Make sure that strlcpy() returns the right value when the bufsize is 0.

parent 1fb8ec4b
......@@ -116,10 +116,12 @@
{
size_t len = strlen(s);
size_t ret = len;
if (bufsize <= 0) return 0;
if (len >= bufsize) len = bufsize-1;
memcpy(d, s, len);
d[len] = 0;
if (bufsize > 0) {
if (len >= bufsize)
len = bufsize-1;
memcpy(d, s, len);
d[len] = 0;
}
return ret;
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment