fdisk(8): Fix a bug when reading >1TB slice sizes from a config file.
authorSascha Wildner <saw@online.de>
Fri, 1 Oct 2010 05:24:20 +0000 (07:24 +0200)
committerSascha Wildner <saw@online.de>
Fri, 1 Oct 2010 05:28:10 +0000 (07:28 +0200)
commit82675d28343600f4e93f6bd6033ee829c2888c4e
treec2f98f5466bf250655a425af634562541ebe1275
parentdfaa15f83eda2a2dd0c348355a4e71ec18fd87c5
fdisk(8): Fix a bug when reading >1TB slice sizes from a config file.

The numerical parameters in configuration file lines were previously
read into signed integers. This would cause a problem with a config
file line like this (for a ~1.2TB slice):

p 1 165 63 2491404993

The length parameter (2491404993) for the slice would have exceeded
INT_MAX (2147483647) and the slice would have been truncated to 1TB.

Since the installer is using fdisk with a configuration file, it
was previously not possible to use a whole >1TB disk from it (one
had to work around it from the command line).

To fix all this, read the numerical parameters in configuration file
lines into a long long.

Note that this change only affects the variable type into which the
parameters read from the file are stored and not any on-disk structures.
Also, checks at different places in fdisk(8) will of course still ensure
that we don't ever go above 2TB.
sbin/fdisk/fdisk.c