mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 15:35:17 +00:00
[#851,!24-p] Address issue in use of strcpy.
This commit is contained in:
@@ -2602,7 +2602,7 @@ checkIfAddrs(const Iface & iface, struct ifaddrs *& ifptr) {
|
|||||||
|
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
memset(& ifr.ifr_name, 0, sizeof ifr.ifr_name);
|
memset(& ifr.ifr_name, 0, sizeof ifr.ifr_name);
|
||||||
strncpy(ifr.ifr_name, iface.getName().c_str(), sizeof ifr.ifr_name);
|
strncpy(ifr.ifr_name, iface.getName().c_str(), sizeof(ifr.ifr_name) - 1);
|
||||||
|
|
||||||
int s = -1; // Socket descriptor
|
int s = -1; // Socket descriptor
|
||||||
|
|
||||||
|
@@ -370,7 +370,7 @@ public:
|
|||||||
// auth key
|
// auth key
|
||||||
bind_[13].buffer_type = MYSQL_TYPE_STRING;
|
bind_[13].buffer_type = MYSQL_TYPE_STRING;
|
||||||
std::string auth_key = host->getKey().toText();
|
std::string auth_key = host->getKey().toText();
|
||||||
std::strncpy(auth_key_, auth_key.c_str(), TEXT_AUTH_KEY_LEN);
|
std::strncpy(auth_key_, auth_key.c_str(), TEXT_AUTH_KEY_LEN - 1);
|
||||||
auth_key_null_ = auth_key.empty() ? MLM_TRUE : MLM_FALSE;
|
auth_key_null_ = auth_key.empty() ? MLM_TRUE : MLM_FALSE;
|
||||||
bind_[13].buffer = auth_key_;
|
bind_[13].buffer = auth_key_;
|
||||||
bind_[13].buffer_length = auth_key.length();
|
bind_[13].buffer_length = auth_key.length();
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
|
// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -56,7 +56,7 @@ bool UnixControlClient::connectToServer(const std::string& socket_path) {
|
|||||||
memset(&srv_addr, 0, sizeof(srv_addr));
|
memset(&srv_addr, 0, sizeof(srv_addr));
|
||||||
srv_addr.sun_family = AF_UNIX;
|
srv_addr.sun_family = AF_UNIX;
|
||||||
strncpy(srv_addr.sun_path, socket_path.c_str(),
|
strncpy(srv_addr.sun_path, socket_path.c_str(),
|
||||||
sizeof(srv_addr.sun_path));
|
sizeof(srv_addr.sun_path) - 1);
|
||||||
socklen_t len = sizeof(srv_addr);
|
socklen_t len = sizeof(srv_addr);
|
||||||
|
|
||||||
// Connect to the specified UNIX socket
|
// Connect to the specified UNIX socket
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
|
// Copyright (C) 2011-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
@@ -103,7 +103,7 @@ SocketSessionForwarder::SocketSessionForwarder(const std::string& unix_file) :
|
|||||||
// paranoid about making it 100% sure even if the check has a bug (with
|
// paranoid about making it 100% sure even if the check has a bug (with
|
||||||
// triggering the assertion in the worse case)
|
// triggering the assertion in the worse case)
|
||||||
strncpy(impl.sock_un_.sun_path, unix_file.c_str(),
|
strncpy(impl.sock_un_.sun_path, unix_file.c_str(),
|
||||||
sizeof(impl.sock_un_.sun_path));
|
sizeof(impl.sock_un_.sun_path) - 1);
|
||||||
assert(impl.sock_un_.sun_path[sizeof(impl.sock_un_.sun_path) - 1] == '\0');
|
assert(impl.sock_un_.sun_path[sizeof(impl.sock_un_.sun_path) - 1] == '\0');
|
||||||
impl.sock_un_len_ = offsetof(struct sockaddr_un, sun_path) +
|
impl.sock_un_len_ = offsetof(struct sockaddr_un, sun_path) +
|
||||||
unix_file.length();
|
unix_file.length();
|
||||||
|
Reference in New Issue
Block a user