Commit 0a3b9663 authored by rswindell's avatar rswindell
Browse files

Don't use strlcpy a we don't have NEEDS_STRLCPY defined anywhere.

parent 0da49d8b
......@@ -872,7 +872,8 @@ BOOL DLLCALL terminate_pid(pid_t pid)
/****************************************************************************/
char* safe_strerror(int errnum, char *buf, size_t buflen)
{
strlcpy(buf, "Unknown error", buflen);
strncpy(buf, "Unknown error", buflen);
buf[buflen - 1] = 0;
#if defined(_WIN32)
strerror_s(buf, buflen, errnum);
......
......@@ -505,7 +505,8 @@ BOOL inet_addrmatch(union xp_sockaddr* addr1, union xp_sockaddr* addr2)
DLLEXPORT char* socket_strerror(int error_number, char* buf, size_t buflen)
{
#if defined(_WINSOCKAPI_)
strlcpy(buf, "Unknown error", buflen);
strncpy(buf, "Unknown error", buflen);
buf[buflen - 1] = 0;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, // dwFlags
NULL, // lpSource
error_number, // dwMessageId
......
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