This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 4fb47a6a6df7e128e539c2577962272c1ccee80f Author: Carlos Sanchez <carlossanc...@geotab.com> AuthorDate: Tue Apr 15 19:03:45 2025 +0200 canutils/slcan: Work with CAN interfaces with names longer than 4 characters. Signed-off-by: Carlos Sanchez <carlossanc...@geotab.com> --- canutils/slcan/slcan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/canutils/slcan/slcan.c b/canutils/slcan/slcan.c index 84d7a1399..e2759a20c 100644 --- a/canutils/slcan/slcan.c +++ b/canutils/slcan/slcan.c @@ -137,8 +137,7 @@ static int caninit(char *candev, int *s, struct sockaddr_can *addr, syslog(LOG_ERR, "Error opening CAN socket\n"); return -1; } - strncpy(ifr.ifr_name, candev, 4); - ifr.ifr_name[4] = '\0'; + strlcpy(ifr.ifr_name, candev, IFNAMSIZ); ifr.ifr_ifindex = if_nametoindex(ifr.ifr_name); if (!ifr.ifr_ifindex) {