From: krw Date: Wed, 29 Sep 2021 22:55:40 +0000 (+0000) Subject: Don't constrain -b specified block count or block size to be greater than 63. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=130c00b787fe1ecabdba40bb1261c1b379f19feb;p=openbsd Don't constrain -b specified block count or block size to be greater than 63. Allow any value from 1 to UINT32_MAX. MBR boot partition sizes/offsets are completely machine dependent. Pointed out by loongson. --- diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 826b034c93d..39e7bbf6ee9 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.137 2021/09/26 13:13:16 krw Exp $ */ +/* $OpenBSD: fdisk.c,v 1.138 2021/09/29 22:55:40 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -227,19 +227,18 @@ parse_bootprt(const char *arg) *ptype++ = '\0'; } - blockcount = strtonum(arg, BLOCKALIGNMENT, UINT32_MAX, &errstr); + blockcount = strtonum(arg, 1, UINT32_MAX, &errstr); if (errstr) - errx(1, "Block argument %s [%u..%u].", errstr, BLOCKALIGNMENT, - UINT32_MAX); + errx(1, "Block argument %s [%u..%u].", errstr, 1, UINT32_MAX); if (poffset == NULL) goto done; /* Second number: # of 512-byte blocks to offset partition start. */ - blockoffset = strtonum(poffset, BLOCKALIGNMENT, UINT32_MAX, &errstr); + blockoffset = strtonum(poffset, 1, UINT32_MAX, &errstr); if (errstr) - errx(1, "Block offset argument %s [%u..%u].", errstr, - BLOCKALIGNMENT, UINT32_MAX); + errx(1, "Block offset argument %s [%u..%u].", errstr, 1, + UINT32_MAX); if (ptype == NULL) goto done;