Date: Mon, 23 Dec 2019 10:11:58 +0200 From: Toomas Soome <tsoome@me.com> To: Ian Lepore <ian@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r356031 - head/stand/i386/gptboot Message-ID: <DD785573-029D-4FD6-AA5B-B33FEC2F8DF1@me.com> In-Reply-To: <201912222233.xBMMXMqu050000@repo.freebsd.org> References: <201912222233.xBMMXMqu050000@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <ian@FreeBSD.org> 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++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DD785573-029D-4FD6-AA5B-B33FEC2F8DF1>