Date: Wed, 19 May 2021 13:35:21 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 178633e28291 - stable/13 - if: Remove unnecessary validation in the SIOCSIFNAME handler Message-ID: <202105191335.14JDZLdc074609@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=178633e28291d2e4168e51e6d970c25bca43bc1e commit 178633e28291d2e4168e51e6d970c25bca43bc1e Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-05-12 14:05:37 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-05-19 13:32:11 +0000 if: Remove unnecessary validation in the SIOCSIFNAME handler A successful copyinstr() call guarantees that the returned string is nul-terminated. Furthermore, the removed check would harmlessly compare an uninitialized byte with '\0' if the new name is shorter than IFNAMESIZ - 1. Reported by: KMSAN Sponsored by: The FreeBSD Foundation (cherry picked from commit ad22ba2b9f3b6ff5d85be14627d3a59ca389f5e4) --- sys/net/if.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 776fcf2fc78d..f6926c43ef96 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2663,11 +2663,6 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) return (error); if (new_name[0] == '\0') return (EINVAL); - if (new_name[IFNAMSIZ-1] != '\0') { - new_name[IFNAMSIZ-1] = '\0'; - if (strlen(new_name) == IFNAMSIZ-1) - return (EINVAL); - } if (strcmp(new_name, ifp->if_xname) == 0) break; if (ifunit(new_name) != NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105191335.14JDZLdc074609>