You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/08/14 11:08:56 UTC
[incubator-nuttx-apps] branch master updated: dhcpd: fix build warning
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 06754940c dhcpd: fix build warning
06754940c is described below
commit 06754940c51e21d5063c12f26423356c142578c6
Author: liuhaitao <li...@xiaomi.com>
AuthorDate: Sat Jul 30 17:14:19 2022 +0800
dhcpd: fix build warning
CC: dhcpd.c
In function 'dhcpd_openlistener',
inlined from 'dhcpd_run.part.0' at dhcpd.c:1513:20:
dhcpd.c:1425:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
1425 | strncpy(req.ifr_name, interface, IFNAMSIZ);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Signed-off-by: liuhaitao <li...@xiaomi.com>
---
netutils/dhcpd/dhcpd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/netutils/dhcpd/dhcpd.c b/netutils/dhcpd/dhcpd.c
index 31e26904f..244e6eabf 100644
--- a/netutils/dhcpd/dhcpd.c
+++ b/netutils/dhcpd/dhcpd.c
@@ -1422,7 +1422,7 @@ static inline int dhcpd_openlistener(FAR const char *interface)
/* Get the IP address of the selected device */
- strncpy(req.ifr_name, interface, IFNAMSIZ);
+ strlcpy(req.ifr_name, interface, IFNAMSIZ);
ret = ioctl(sockfd, SIOCGIFADDR, (unsigned long)&req);
if (ret < 0)
{