1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00

fix(gcc): Fix -Wstringop-truncation warning

As mentioned in #1215, gcc >=8 will complain, if strncpy truncates the
source string or gcc can prove there is no NUL terminating byte.

This also updates the i3ipcpp submodule where there was a similar error

Fixes #1215
This commit is contained in:
patrick96 2018-05-06 18:33:10 +02:00 committed by NBonaparte
parent f2010edf94
commit 8173a6473e
2 changed files with 7 additions and 2 deletions

@ -1 +1 @@
Subproject commit a6aa7a19786bdf7b96a02900510b3b3c325c8bdf
Subproject commit d4e4786be35b48d72dc7e59cf85ec34a90d129b5

View file

@ -159,7 +159,12 @@ namespace net {
driver.cmd = ETHTOOL_GDRVINFO;
memset(&request, 0, sizeof(request));
strncpy(request.ifr_name, m_interface.c_str(), IFNAMSIZ - 0);
/*
* Only copy array size minus one bytes over to ensure there is a
* terminating NUL byte (which is guaranteed by memset)
*/
strncpy(request.ifr_name, m_interface.c_str(), IFNAMSIZ - 1);
request.ifr_data = reinterpret_cast<caddr_t>(&driver);