csplit: size_t overflow check

* src/csplit.c (get_new_buffer): Fix unlikely size_t overflow.
This commit is contained in:
Paul Eggert committed 2021-04-26 23:32:45 -07:00
1 parent 5fcf8c6487
commit 8527942835
1 file changed
+2 -1
+2 -1
View File
@@ -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);