summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-10-08 17:14:05 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-10-08 17:14:05 +0000
commitffd63c643fb91665eb6cd4e412079a391a52b979 (patch)
tree142febdec3fc07ba91739a046dbc925318da2249 /usr.bin/tmux
parent6a57ad658c62e0a92261f439dd16826a1eee5130 (diff)
Use xrealloc(NULL, n, m) instead of xmalloc(n * m) to get overflow
check.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/grid.c5
-rw-r--r--usr.bin/tmux/paste.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c
index d7d716a7d2f..5c53bc7d6c0 100644
--- a/usr.bin/tmux/grid.c
+++ b/usr.bin/tmux/grid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid.c,v 1.39 2014/09/17 15:31:38 nicm Exp $ */
+/* $OpenBSD: grid.c,v 1.40 2014/10/08 17:14:04 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -724,7 +724,8 @@ grid_reflow_split(struct grid *dst, u_int *py, struct grid_line *src_gl,
to_copy = src_gl->cellsize;
/* Expand destination line. */
- dst_gl->celldata = xmalloc(to_copy * sizeof *dst_gl->celldata);
+ dst_gl->celldata = xrealloc(NULL, to_copy,
+ sizeof *dst_gl->celldata);
dst_gl->cellsize = to_copy;
dst_gl->flags |= GRID_LINE_WRAPPED;
diff --git a/usr.bin/tmux/paste.c b/usr.bin/tmux/paste.c
index 05b421cae22..88e03159d0a 100644
--- a/usr.bin/tmux/paste.c
+++ b/usr.bin/tmux/paste.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: paste.c,v 1.23 2014/09/01 21:50:18 nicm Exp $ */
+/* $OpenBSD: paste.c,v 1.24 2014/10/08 17:14:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -279,7 +279,7 @@ paste_make_sample(struct paste_buffer *pb, int utf8flag)
len = pb->size;
if (len > width)
len = width;
- buf = xmalloc(len * 4 + 4);
+ buf = xrealloc(NULL, len, 4 + 4);
if (utf8flag)
used = utf8_strvis(buf, pb->data, len, flags);