From 9e548bd59140bd67736375afbe5e7e98e8a67b43 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Wed, 11 Dec 2019 12:11:15 +0100 Subject: [PATCH] Problem: insecure and inefficient strcpy used Solution: use memcpy with known length --- src/ip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ip.cpp b/src/ip.cpp index 4cefb9a9..81d298a3 100644 --- a/src/ip.cpp +++ b/src/ip.cpp @@ -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 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