Date: Fri, 1 Feb 2019 08:40:11 +0800 From: Marcelo Araujo <araujobsdport@gmail.com> To: Warner Losh <imp@bsdimp.com> Cc: Konstantin Belousov <kostikbel@gmail.com>, Marcelo Araujo <araujo@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r343634 - head/usr.sbin/bhyve Message-ID: <CAOfEmZhi%2Bj5D0KvSSE0HjwNZGiko5eGLtviFRdbBrk31g-GB%2Bw@mail.gmail.com> In-Reply-To: <CANCZdfoL=n2Bo-waSfNth2Q-ZN8Ej%2BvZ6_no7QWSRnNfQnAqxA@mail.gmail.com> References: <201901312332.x0VNWJ6o016057@repo.freebsd.org> <20190131234609.GZ24863@kib.kiev.ua> <CANCZdfoL=n2Bo-waSfNth2Q-ZN8Ej%2BvZ6_no7QWSRnNfQnAqxA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Em sex, 1 de fev de 2019 =C3=A0s 08:36, Warner Losh <imp@bsdimp.com> escrev= eu: > > > On Thu, Jan 31, 2019, 4:46 PM Konstantin Belousov <kostikbel@gmail.com > wrote: > >> On Thu, Jan 31, 2019 at 11:32:19PM +0000, Marcelo Araujo wrote: >> > Author: araujo >> > Date: Thu Jan 31 23:32:19 2019 >> > New Revision: 343634 >> > URL: https://svnweb.freebsd.org/changeset/base/343634 >> > >> > Log: >> > Mostly a cosmetic change to replace strlen with strnlen. >> This is not cosmetic, and more, for instance the usage() part of the >> change >> does not make any sense to me. >> > > I specifically objected as well and was blown off. What gives? > I have asked you feedback and got none! I will revert the usage() changes later then. Best, > > Warner > > > >> > Obtained from: Project ACRN >> > MFC after: 2 weeks >> > >> > Modified: >> > head/usr.sbin/bhyve/bhyverun.c >> > head/usr.sbin/bhyve/smbiostbl.c >> > head/usr.sbin/bhyve/usb_mouse.c >> > >> > Modified: head/usr.sbin/bhyve/bhyverun.c >> > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> > --- head/usr.sbin/bhyve/bhyverun.c Thu Jan 31 23:21:18 2019 >> (r343633) >> > +++ head/usr.sbin/bhyve/bhyverun.c Thu Jan 31 23:32:19 2019 >> (r343634) >> > @@ -233,8 +233,8 @@ usage(int code) >> > " -W: force virtio to use single-vector MSI\n" >> > " -x: local apic is in x2APIC mode\n" >> > " -Y: disable MPtable generation\n", >> > - progname, (int)strlen(progname), "", >> (int)strlen(progname), "", >> > - (int)strlen(progname), ""); >> > + progname, (int)strnlen(progname, PATH_MAX), "", >> (int)strnlen(progname, PATH_MAX), "", >> > + (int)strnlen(progname, PATH_MAX), ""); >> > >> > exit(code); >> > } >> > >> > Modified: head/usr.sbin/bhyve/smbiostbl.c >> > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> > --- head/usr.sbin/bhyve/smbiostbl.c Thu Jan 31 23:21:18 2019 >> (r343633) >> > +++ head/usr.sbin/bhyve/smbiostbl.c Thu Jan 31 23:32:19 2019 >> (r343634) >> > @@ -558,7 +558,7 @@ smbios_generic_initializer(struct smbios_structure >> *te >> > int len; >> > >> > string =3D template_strings[i]; >> > - len =3D strlen(string) + 1; >> > + len =3D strnlen(string, SMBIOS_MAX_LENGTH) + 1; >> > memcpy(curaddr, string, len); >> > curaddr +=3D len; >> > } >> > @@ -611,7 +611,7 @@ smbios_type1_initializer(struct smbios_structure >> *temp >> > return (-1); >> > >> > MD5Init(&mdctx); >> > - MD5Update(&mdctx, vmname, strlen(vmname)); >> > + MD5Update(&mdctx, vmname, strnlen(vmname, PATH_MAX)); >> > MD5Update(&mdctx, hostname, sizeof(hostname)); >> > MD5Final(digest, &mdctx); >> > >> > >> > Modified: head/usr.sbin/bhyve/usb_mouse.c >> > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> > --- head/usr.sbin/bhyve/usb_mouse.c Thu Jan 31 23:21:18 2019 >> (r343633) >> > +++ head/usr.sbin/bhyve/usb_mouse.c Thu Jan 31 23:32:19 2019 >> (r343634) >> > @@ -70,6 +70,7 @@ enum { >> > UMSTR_MAX >> > }; >> > >> > +#define UMOUSE_DESC_MAX_LEN 32 >> > static const char *umouse_desc_strings[] =3D { >> > "\x04\x09", >> > "BHYVE", >> > @@ -441,7 +442,7 @@ umouse_request(void *scarg, struct usb_data_xfer >> *xfer >> > goto done; >> > } >> > >> > - slen =3D 2 + strlen(str) * 2; >> > + slen =3D 2 + strnlen(str, UMOUSE_DESC_MAX_LEN) *= 2; >> > udata[0] =3D slen; >> > udata[1] =3D UDESC_STRING; >> > >> >> --=20 --=20 Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfEmZhi%2Bj5D0KvSSE0HjwNZGiko5eGLtviFRdbBrk31g-GB%2Bw>