Use secure string function when compiling with a recent MSVC.
This commit is contained in:
parent
ba4c189efb
commit
b749ace67f
@ -493,8 +493,13 @@ int context::password_callback_function(
|
|||||||
std::string passwd = callback->call(static_cast<std::size_t>(size),
|
std::string passwd = callback->call(static_cast<std::size_t>(size),
|
||||||
purpose ? context_base::for_writing : context_base::for_reading);
|
purpose ? context_base::for_writing : context_base::for_reading);
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
|
||||||
|
strcpy_s(buf, size, passwd.c_str());
|
||||||
|
#else
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
strncat(buf, passwd.c_str(), size);
|
strncat(buf, passwd.c_str(), size);
|
||||||
|
#endif
|
||||||
|
|
||||||
return strlen(buf);
|
return strlen(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user