]> git.ipfire.org Git - thirdparty/coreutils.git/commit
csplit: improve integer overflow checking
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 27 Jan 2022 20:06:21 +0000 (12:06 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 27 Jan 2022 21:04:14 +0000 (13:04 -0800)
commit3b98e21eeda03667cf43e61b96cd6527582596f2
tree0f87af71f6e8edd848ee877c1bc0099514c1febb
parentb973d2d44a0bc92090ff2638a737e4a369497cb1
csplit: improve integer overflow checking

* src/csplit.c: Prefer signed integers to unsigned for sizes
when either will do.  Check for some unlikely overflows.
(INCR_SIZE): Remove; no longer used.
(free_buffer): Also free the arg, simplifying callers.
(get_new_buffer): Use xpalloc instead of computing new
size by hand.  Add ATTRIBUTE_DEALLOC.
(delete_all_files, close_output_file):
If unlink fails with ENOENT, treat it as success.
(close_output_file): If unlink fails, decrement count anyway.
(parse_repeat_count, parse_patterns): Check for int overflow.
(check_format_conv_type): Use signed format.
src/csplit.c