summaryrefslogtreecommitdiff
path: root/usr.bin/less/line.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-02 23:02:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-04-02 23:02:07 +0000
commit300cc30b08df1e760ce0cd243e0069150c47d465 (patch)
treee9b7829cf7608faa11c9ee74d57b5869e80bf8bb /usr.bin/less/line.c
parent124a1e20951dd7c844f62ae2170227b325a85872 (diff)
The character buffer should be resized using recallocarray()
ok millert and nicm a while ago
Diffstat (limited to 'usr.bin/less/line.c')
-rw-r--r--usr.bin/less/line.c4
1 files 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);