struct ifreq ifr;
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
// auth key
bind_[13].buffer_type = MYSQL_TYPE_STRING;
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;
bind_[13].buffer = auth_key_;
bind_[13].buffer_length = auth_key.length();
-// 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
// License, v. 2.0. If a copy of the MPL was not distributed with this
memset(&srv_addr, 0, sizeof(srv_addr));
srv_addr.sun_family = AF_UNIX;
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);
// Connect to the specified UNIX socket
-// 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
// License, v. 2.0. If a copy of the MPL was not distributed with this
// paranoid about making it 100% sure even if the check has a bug (with
// triggering the assertion in the worse case)
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');
impl.sock_un_len_ = offsetof(struct sockaddr_un, sun_path) +
unix_file.length();