aboutsummaryrefslogtreecommitdiffstats
path: root/src/termcap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/termcap.c')
-rw-r--r--src/termcap.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/termcap.c b/src/termcap.c
index 791c593c06f..6f24817fa72 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -637,13 +637,10 @@ gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end)
637 { 637 {
638 ptrdiff_t ptr_offset = bufp->ptr - buf; 638 ptrdiff_t ptr_offset = bufp->ptr - buf;
639 ptrdiff_t append_end_offset = append_end - buf; 639 ptrdiff_t append_end_offset = append_end - buf;
640 ptrdiff_t size;
641 if ((min (PTRDIFF_MAX, SIZE_MAX) - 1) / 2 < bufp->size)
642 memory_full (SIZE_MAX);
643 size = 2 * bufp->size;
644 /* Add 1 to size to ensure room for terminating null. */ 640 /* Add 1 to size to ensure room for terminating null. */
645 bufp->beg = buf = (char *) xrealloc (buf, size + 1); 641 ptrdiff_t size = bufp->size + 1;
646 bufp->size = size; 642 bufp->beg = buf = xpalloc (buf, &size, 1, -1, 1);
643 bufp->size = size - 1;
647 bufp->ptr = buf + ptr_offset; 644 bufp->ptr = buf + ptr_offset;
648 append_end = buf + append_end_offset; 645 append_end = buf + append_end_offset;
649 } 646 }