diff options
author | Peter Hatina <phatina@redhat.com> | 2012-04-03 08:41:42 +0200 |
---|---|---|
committer | Peter Hatina <phatina@redhat.com> | 2012-04-03 08:41:42 +0200 |
commit | 7642bb5bac11cb13fa69fc09e246389de0ce31c0 (patch) | |
tree | 7939f6733ec24f62444f472b1e8483d4ffb7422e /SpiceXPI | |
parent | 3998d44bd1305c4c784e7d2529954f6ccbb96986 (diff) |
check string length before calling strcpy
Diffstat (limited to 'SpiceXPI')
-rw-r--r-- | SpiceXPI/src/plugin/controller.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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)); |