mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 06:20:10 +01:00
platform: avoid wrong coverity warning in nmp_utils_sysctl_open_netdir()
The warning is wrong, because we already assert for the string length a few lines earlier. Error: STRING_OVERFLOW (CWE-120): [#def595] NetworkManager-1.31.90/src/libnm-platform/nm-platform-utils.c:1896: fixed_size_dest: You might overrun the 16-character fixed-size string "ifname_buf_last_try" by copying "ifname" without checking the length. # 1894| if (nm_streq(ifname, ifname_buf_last_try)) # 1895| return -1; # 1896|-> strcpy(ifname_buf_last_try, ifname); # 1897| # 1898| fd_dir = open(sysdir, O_DIRECTORY | O_CLOEXEC);
This commit is contained in:
parent
b57167fe74
commit
c87433ebd2
1 changed files with 3 additions and 1 deletions
|
|
@ -1893,7 +1893,9 @@ nmp_utils_sysctl_open_netdir(int ifindex, const char *ifname_guess, char *out_if
|
|||
* end of the @try_count. */
|
||||
if (nm_streq(ifname, ifname_buf_last_try))
|
||||
return -1;
|
||||
strcpy(ifname_buf_last_try, ifname);
|
||||
|
||||
if (g_strlcpy(ifname_buf_last_try, ifname, IFNAMSIZ) >= IFNAMSIZ)
|
||||
nm_assert_not_reached();
|
||||
|
||||
fd_dir = open(sysdir, O_DIRECTORY | O_CLOEXEC);
|
||||
if (fd_dir < 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue