From 300cc30b08df1e760ce0cd243e0069150c47d465 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 2 Apr 2017 23:02:07 +0000 Subject: The character buffer should be resized using recallocarray() ok millert and nicm a while ago --- usr.bin/less/line.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/less/line.c b/usr.bin/less/line.c index 629402d4c29..42d1a24502b 100644 --- a/usr.bin/less/line.c +++ b/usr.bin/less/line.c @@ -94,8 +94,8 @@ expand_linebuf(void) int new_size = size_linebuf * 2; /* Just realloc to expand the buffer, if we can. */ - char *new_buf = realloc(linebuf, new_size); - char *new_attr = realloc(attr, new_size); + char *new_buf = recallocarray(linebuf, size_linebuf, new_size, 1); + char *new_attr = recallocarray(attr, size_linebuf, new_size, 1); if (new_buf == NULL || new_attr == NULL) { free(new_attr); free(new_buf); -- cgit v1.2.3