Date: Sat, 6 Jan 2018 12:46:04 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327619 - head/lib/libc/net Message-ID: <201801061246.w06Ck4H9033553@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Sat Jan 6 12:46:04 2018 New Revision: 327619 URL: https://svnweb.freebsd.org/changeset/base/327619 Log: The source strings are from the password database which guarantees that the data going into it is sane. Out of an abundance of caution, limit the string copies to prevent an overflow. CID: 1019035 Modified: head/lib/libc/net/rcmd.c Modified: head/lib/libc/net/rcmd.c ============================================================================== --- head/lib/libc/net/rcmd.c Sat Jan 6 12:45:59 2018 (r327618) +++ head/lib/libc/net/rcmd.c Sat Jan 6 12:46:04 2018 (r327619) @@ -457,8 +457,8 @@ again: first = 0; if ((pwd = getpwnam(luser)) == NULL) return (-1); - (void)strcpy(pbuf, pwd->pw_dir); - (void)strcat(pbuf, "/.rhosts"); + (void)strlcpy(pbuf, pwd->pw_dir, sizeof(pbuf)); + (void)strlcat(pbuf, "/.rhosts", sizeof(pbuf)); /* * Change effective uid while opening .rhosts. If root and
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801061246.w06Ck4H9033553>