diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-04-02 23:02:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-04-02 23:02:07 +0000 |
commit | 300cc30b08df1e760ce0cd243e0069150c47d465 (patch) | |
tree | e9b7829cf7608faa11c9ee74d57b5869e80bf8bb /usr.bin/less/line.c | |
parent | 124a1e20951dd7c844f62ae2170227b325a85872 (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.c | 4 |
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); |