xiaoxiang781216 commented on code in PR #3059: URL: https://github.com/apache/nuttx-apps/pull/3059#discussion_r2045139027
########## canutils/slcan/slcan.c: ########## @@ -137,8 +137,8 @@ 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'; + strncpy(ifr.ifr_name, candev, IFNAMSIZ); Review Comment: strlcpy ########## canutils/slcan/slcan.c: ########## @@ -137,8 +137,8 @@ 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'; + strncpy(ifr.ifr_name, candev, IFNAMSIZ); + ifr.ifr_name[IFNAMSIZ] = '\0'; Review Comment: remove -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org