summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-menu.h
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-05-30 15:37:05 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-06-12 13:03:59 +1000
commit32952937bc5c3753ff2f8f4612da5ba51bf69759 (patch)
treeb483f94a243422fad9bcad0da2dd27104c48d46e /ui/ncurses/nc-menu.h
parente54e26065cea435fed19b8b2687c87927f1b63f1 (diff)
downloadtalos-petitboot-32952937bc5c3753ff2f8f4612da5ba51bf69759.tar.gz
talos-petitboot-32952937bc5c3753ff2f8f4612da5ba51bf69759.zip
discover/network: Null terminate ifname buffer explicitly
GCC 8 produces the following warning for network.c: In function ‘network_handle_nlmsg’, inlined from ‘network_netlink_process’ at ../discover/network.c:726:3: ../discover/network.c:568:3: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 16 [-Wstringop-truncation] strncpy(interface->name, ifname, sizeof(interface->name) - 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../discover/network.c:586:3: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 16 [-Wstringop-truncation] strncpy(interface->name, ifname, sizeof(interface->name) - 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The code is safe since interface is allocated with talloc_zero() and we could use -Wno-stringop-truncation to hide this but since this is the only offender instead just copy the whole IFNAMSIZ bytes and explicitly terminate the ifname buffer to be safe. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'ui/ncurses/nc-menu.h')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud