]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib: [strutils] avoid integer overflow on large values
authorDave Reisner <d@falconindy.com>
Tue, 15 Feb 2011 09:06:08 +0000 (10:06 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Apr 2011 12:25:23 +0000 (14:25 +0200)
commit8fd1f04e5576d299e4e6f8cd3da8cc5f638b7c77
tree19658c0c10507172c347b17d85d60e0a32e4e5e1
parentf295fff8dc701a6492df865b57a1715c762723c6
lib: [strutils] avoid integer overflow on large values

This is visible on a 2TB disk via lsblk, where a large partition
incorrectly displays as 1.171798692T instead of 1.8T. This is
corrected by using a uint64_t type instead of a simple int --
consistant with the type used in lsblk.c to represent the raw size in
bytes.

[kzak@redhat.com: - add EiB support
                  - add size_to_human_string() to regression tests]

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/strutils.c
tests/expected/misc/strtosize