mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
csplit: size_t overflow check
* src/csplit.c (get_new_buffer): Fix unlikely size_t overflow.
This commit is contained in:
1 parent
5fcf8c6487
commit
8527942835
1 file changed
+2
-1
+2
-1
@@ -416,7 +416,8 @@ get_new_buffer (size_t min_size)
|
||||
if (alloc_size < min_size)
|
||||
{
|
||||
size_t s = min_size - alloc_size + INCR_SIZE - 1;
|
||||
alloc_size += s - s % INCR_SIZE;
|
||||
if (INT_ADD_WRAPV (alloc_size, s - s % INCR_SIZE, &alloc_size))
|
||||
xalloc_die ();
|
||||
}
|
||||
|
||||
new_buffer = create_new_buffer (alloc_size);
|
||||
|
||||
Reference in new issue
Block a user