0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-14 17:58:01 +08:00

Problem: insecure and inefficient strcpy used

Solution: use memcpy with known length
This commit is contained in:
Simon Giesecke 2019-12-11 12:11:15 +01:00 committed by Simon Giesecke
parent 3e7995f7f7
commit 9e548bd591

View File

@ -879,7 +879,7 @@ int zmq::create_ipc_wildcard_address (std::string &path_, std::string &file_)
// We need room for tmp_path + trailing NUL
std::vector<char> buffer (tmp_path.length () + 1);
strcpy (&buffer[0], tmp_path.c_str ());
memcpy (&buffer[0], tmp_path.c_str (), tmp_path.length () + 1);
#if defined HAVE_MKDTEMP
// Create the directory. POSIX requires that mkdtemp() creates the