From 7642bb5bac11cb13fa69fc09e246389de0ce31c0 Mon Sep 17 00:00:00 2001 From: Peter Hatina Date: Tue, 3 Apr 2012 08:41:42 +0200 Subject: check string length before calling strcpy --- SpiceXPI/src/plugin/controller.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SpiceXPI/src/plugin/controller.cpp b/SpiceXPI/src/plugin/controller.cpp index 23c853b..4c6ce9f 100644 --- a/SpiceXPI/src/plugin/controller.cpp +++ b/SpiceXPI/src/plugin/controller.cpp @@ -96,6 +96,8 @@ int SpiceController::Connect() struct sockaddr_un remote; remote.sun_family = AF_UNIX; + if (m_name.length() + 1 > sizeof(remote.sun_path)) + return -1; strcpy(remote.sun_path, m_name.c_str()); int rc = connect(m_client_socket, (struct sockaddr *) &remote, strlen(remote.sun_path) + sizeof(remote.sun_family)); -- cgit v1.2.3