From owner-svn-src-all@freebsd.org Mon Dec 23 08:12:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F02151E925F for ; Mon, 23 Dec 2019 08:12:04 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-zteg10011401.me.com (pv50p00im-zteg10011401.me.com [17.58.6.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47hBsJ0v5xz4Mf2 for ; Mon, 23 Dec 2019 08:12:03 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-zteg10011401.me.com (Postfix) with ESMTPSA id 2414490071E; Mon, 23 Dec 2019 08:12:00 +0000 (UTC) From: Toomas Soome Message-Id: Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Subject: Re: svn commit: r356031 - head/stand/i386/gptboot Date: Mon, 23 Dec 2019 10:11:58 +0200 In-Reply-To: <201912222233.xBMMXMqu050000@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Ian Lepore References: <201912222233.xBMMXMqu050000@repo.freebsd.org> X-Mailer: Apple Mail (2.3608.40.2.2.4) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-12-23_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1912230071 X-Rspamd-Queue-Id: 47hBsJ0v5xz4Mf2 X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; FREEMAIL_FROM(0.00)[me.com]; MV_CASE(0.50)[]; URI_COUNT_ODD(1.00)[3]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; RECEIVED_SPAMHAUS_PBL(0.00)[148.52.235.80.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; RCVD_IN_DNSWL_LOW(-0.10)[41.6.58.17.list.dnswl.org : 127.0.5.1]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:714, ipnet:17.58.0.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[me.com]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(0.00)[ip: (-3.94), ipnet: 17.58.0.0/20(-1.88), asn: 714(-2.18), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; DWL_DNSWL_LOW(-1.00)[me.com.dwl.dnswl.org : 127.0.5.1]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2019 08:12:05 -0000 The only limit set by specification is: A minimum of 16,384 bytes of space must be reserved for the GPT = Partition Entry Array. =46rom this size and array entry size we do get 128, but specification = does not limit the max number. rgds, toomas > On 23. Dec 2019, at 00:33, Ian Lepore wrote: >=20 > Author: ian > Date: Sun Dec 22 22:33:22 2019 > New Revision: 356031 > URL: https://svnweb.freebsd.org/changeset/base/356031 >=20 > Log: > In gptboot, don't assume a partition number is a single digit, 1-9. = GPT > partitions can have 128 partitions, so parse contiguous digits and = then > validate that the number is between 1-128 inclusive. >=20 > I'm not sure 128 is a hard limit in the GPT standard, but it's the = common > number in use, and it's a better upper limit than 9. >=20 > Modified: > head/stand/i386/gptboot/gptboot.c >=20 > Modified: head/stand/i386/gptboot/gptboot.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/stand/i386/gptboot/gptboot.c Sun Dec 22 22:10:20 2019 = (r356030) > +++ head/stand/i386/gptboot/gptboot.c Sun Dec 22 22:33:22 2019 = (r356031) > @@ -574,10 +574,12 @@ parse_cmds(char *cmdstr, int *dskupdated) > if (arg[1] !=3D 'p' || gdsk.dsk.unit > = 9) > return (-1); > arg +=3D 2; > - gdsk.dsk.part =3D *arg - '0'; > - if (gdsk.dsk.part < 1 || gdsk.dsk.part > = 9) > + j =3D 0; > + while (*arg >=3D '0' && *arg <=3D '9') > + j =3D j * 10 + *arg++ - '0'; > + gdsk.dsk.part =3D j; > + if (gdsk.dsk.part < 1 || gdsk.dsk.part > = 128) > return (-1); > - arg++; > if (arg[0] !=3D ')') > return (-1); > arg++;