diff options
author | Jan Beich <[email protected]> | 2023-04-23 20:20:29 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2023-04-23 21:20:29 +0100 |
commit | f7579fc9231e3c73d5b94e66277f49d03d243b00 (patch) | |
tree | 7cab83a9b1f1a1712cf02d3f013df0299c7e4203 /hyprctl | |
parent | fbcbe947dacd62c93dd2e9c2f90fa827da67fd9c (diff) | |
download | Hyprland-f7579fc9231e3c73d5b94e66277f49d03d243b00.tar.gz Hyprland-f7579fc9231e3c73d5b94e66277f49d03d243b00.zip |
internal: unhardcode sun_path size after a6cfe7042897 (#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);
^
Diffstat (limited to 'hyprctl')
-rw-r--r-- | hyprctl/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp index 1639bb67..2f7ab2b9 100644 --- a/hyprctl/main.cpp +++ b/hyprctl/main.cpp @@ -80,7 +80,7 @@ void request(std::string arg, int minArgs = 0) { 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) { 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"; - 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) { std::cout << "Couldn't connect to " << socketPath << ". (3)"; |