mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 07:05:58 +01:00
internal: unhardcode sun_path size after a6cfe70428
(#2137)
hyprctl/main.cpp:83:5: warning: 'strncpy' size argument is too large; destination buffer has size 104, but size argument is 107 [-Wfortify-source] strncpy(serverAddress.sun_path, socketPath.c_str(), 107); ^ hyprctl/main.cpp:146:5: warning: 'strncpy' size argument is too large; destination buffer has size 104, but size argument is 107 [-Wfortify-source] strncpy(serverAddress.sun_path, socketPath.c_str(), 107); ^ src/managers/EventManager.cpp:70:9: warning: 'strncpy' size argument is too large; destination buffer has size 104, but size argument is 107 [-Wfortify-source] strncpy(SERVERADDRESS.sun_path, socketPath.c_str(), 107); ^
This commit is contained in:
parent
fbcbe947da
commit
f7579fc923
2 changed files with 3 additions and 3 deletions
|
@ -80,7 +80,7 @@ void request(std::string arg, int minArgs = 0) {
|
||||||
|
|
||||||
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock";
|
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock";
|
||||||
|
|
||||||
strncpy(serverAddress.sun_path, socketPath.c_str(), 107);
|
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
|
||||||
|
|
||||||
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
|
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
|
||||||
std::cout << "Couldn't connect to " << socketPath << ". (3)";
|
std::cout << "Couldn't connect to " << socketPath << ". (3)";
|
||||||
|
@ -143,7 +143,7 @@ void requestHyprpaper(std::string arg) {
|
||||||
|
|
||||||
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.hyprpaper.sock";
|
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.hyprpaper.sock";
|
||||||
|
|
||||||
strncpy(serverAddress.sun_path, socketPath.c_str(), 107);
|
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
|
||||||
|
|
||||||
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
|
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
|
||||||
std::cout << "Couldn't connect to " << socketPath << ". (3)";
|
std::cout << "Couldn't connect to " << socketPath << ". (3)";
|
||||||
|
|
|
@ -67,7 +67,7 @@ void CEventManager::startThread() {
|
||||||
|
|
||||||
sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX};
|
sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX};
|
||||||
std::string socketPath = "/tmp/hypr/" + g_pCompositor->m_szInstanceSignature + "/.socket2.sock";
|
std::string socketPath = "/tmp/hypr/" + g_pCompositor->m_szInstanceSignature + "/.socket2.sock";
|
||||||
strncpy(SERVERADDRESS.sun_path, socketPath.c_str(), 107);
|
strncpy(SERVERADDRESS.sun_path, socketPath.c_str(), sizeof(SERVERADDRESS.sun_path) - 1);
|
||||||
|
|
||||||
bind(SOCKET, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS));
|
bind(SOCKET, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue