Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

lib/strutils: fix string_add_to_idarray() int vs. size_t

The function uses "int" as argument, but for array size (and index) is better
to use unsigned type (size_t). If we mix "size_t" in util (e.g. fdisk)
and "int" in lib/strutils.c then result is unexpected behavior on

	# sfdisk --list -o DEVICE,START,SIZE /dev/sdb
	Disk /dev/sdb: 50 MiB, 52428800 bytes, 102400 sectors
	Units: sectors of 1 * 512 = 512 bytes
	Sector size (logical/physical): 512 bytes / 4096 bytes
	I/O size (minimum/optimal): 4096 bytes / 32768 bytes
	Disklabel type: gpt
	Disk identifier: 3B8559DB-33AF-43E9-BEFC-C331D829B539
	lt-sfdisk: libfdisk/src/label.c:178: fdisk_label_get_field: Assertion `id > 0' failed.

The patch cleanup all code to use size_t everywhere.

Signed-off-by: Karel Zak <>
latest commit 40b175084f
@karelzak authored
Failed to load latest commit information. build-sys: fix typo
all-io.h include/c.h: prefer nanosleep() over usleep()
at.h lib: [at.c] add readlink_at(), fix semantic for absolute paths
bitops.h include: cleanup copyright headers
blkdev.h Fix typo "ioclt" in various files.
c.h include/c: define UL_ASAN_BLACKLIST address_sanitizer function attribute
canonicalize.h include: cleanup copyright headers
carefulputc.h include/carefulputc: encode also ' and $ in fputs_quoted() output
closestream.h include/closestream: don't wipe errno on EPIPE
colors.h lib/colors: add USAGE_COLORS_DEFAULT
cpuset.h include: cleanup copyright headers
crc32.h lib: add crc64()
crc64.h lib: add crc64()
debug.h include/debug: improve and cleanup
env.h include/env: unify indentation
exec_shell.h unshare,nsenter: spawn shell by default
exitcodes.h include/exitcodes: clean up names, add _EX_ suffix
fileutils.h libmount: add new libmnt_monitor API
ismounted.h lib: import whole ismounted.c code from e2fsprogs
linux_reboot.h Imported from util-linux-2.13-pre1 tarball.
linux_version.h lib: add linux_version.{c,h}
list.h include: fix compiler warnings
loopdev.h lib/loopdev: replace custom DBG() with include/debug.h
mangle.h lib/mangle: cleanup, add unhexmangle
match.h lib,match: split match_fstype() from libmount
mbsalign.h lib/mbalign: report also size in bytes
md5.h build-sys: check HAVE_ definitions with #ifdef [smatch scan]
minix.h libblkid: arch independent minix detection
monotonic.h lib/timer: use separate file for timers
namespace.h include: fix SYS_{unshare,nsenter} usage
nls.h lib/strutils: circumvent missing localeconv()
optutils.h include/optutils: fix typo
pager.h lib: add pager functionality
pamfail.h login-utils: Enable building util-linux against OpenPAM
path.h lib/path: add path_strdup()
pathnames.h agetty: support /usr/lib/os-release too
procutils.h lib/procutils: add simple API to scan /proc/PID/*
pt-bsd.h fdisk: (bsd) write/read PT code cleanup
pt-mbr-partnames.h libfdisk: recognize FAT32 partitions hidden by Acronis software
pt-mbr.h libfdisk: support bootbits protection from (p)MBR
pt-sgi.h fdisk: (sgi) fix unsigned integer overflow [AddressSanitizer]
pt-sun.h libblkid: rename in sun_disklabel for compatibility with fdisk
randutils.h mcookie: use lib/randutils
readutmp.h lslogins: add readtump.h header
rpmatch.h rpmatch: use symbolic value when evaluation return codes
setproctitle.h lib: cleanup setproctitle.c
statfs_magic.h include/statfs_magic: use macro rather than type for f_type
strutils.h lib/strutils: fix string_add_to_idarray() int vs. size_t
swapheader.h mkswap: remove unnecessary size check
swapprober.h swapon: split swapon-common.c
sysfs.h lib/sysfs: add subsystem and hotplug detection
timer.h lib/timer: use separate file for timers
timeutils.h build-sys: move all around clock_gettime() to monotonic.c
ttyutils.h agetty: fixing FTBFS on !linux (Debian util-linux 2.20.1-1.2)
widechar.h build-sys: fix ifdef ENABLE_WIDECHAR usage
xalloc.h silence compiler warning
Something went wrong with that request. Please try again.