c++: Fix possible string truncation
[awesomized/libmemcached] / libtest / socket.cc
index 667a0219a32cd113520d25b6c9ec358c1a6fea7a..9e06841ac9abe2de3b64f7ee69c4a699ad863959 100644 (file)
@@ -34,7 +34,7 @@
  *
  */
 
-#include "mem_config.h"
+#include "libtest/yatlcon.h"
 #include <libtest/common.h>
 
 static char global_socket[1024]= { 0 };
@@ -55,7 +55,7 @@ void set_default_socket(const char *socket)
 {
   if (socket)
   {
-    strncpy(global_socket, socket, strlen(socket));
+    strncpy(global_socket, socket, sizeof(global_socket)-1);
   }
 }