summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/grid.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-08-24 22:49:13 +0000
committernicm <nicm@openbsd.org>2015-08-24 22:49:13 +0000
commitabb4058af2a63f4ed4fdc90c61bdf96f90e5f3ae (patch)
tree625e40d4a3fc6dad141722421f4d27b4a28f96c2 /usr.bin/tmux/grid.c
parentEnable path MTU test with ping for IPv6. Scapy srp1() does not (diff)
downloadwireguard-openbsd-abb4058af2a63f4ed4fdc90c61bdf96f90e5f3ae.tar.xz
wireguard-openbsd-abb4058af2a63f4ed4fdc90c61bdf96f90e5f3ae.zip
In grid_duplicate_lines, if the line is empty (cellsize == 0) then clear
the destination celldata pointer rather than leaving a stale copy of the source pointer (which may later be freed). Fixes a crash found by Kuang-che Wu.
Diffstat (limited to 'usr.bin/tmux/grid.c')
-rw-r--r--usr.bin/tmux/grid.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c
index e2d1cd500a2..373a1241226 100644
--- a/usr.bin/tmux/grid.c
+++ b/usr.bin/tmux/grid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid.c,v 1.43 2015/05/08 15:56:49 nicm Exp $ */
+/* $OpenBSD: grid.c,v 1.44 2015/08/24 22:49:13 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -652,7 +652,8 @@ grid_duplicate_lines(struct grid *dst, u_int dy, struct grid *src, u_int sy,
srcl->cellsize, sizeof *dstl->celldata);
memcpy(dstl->celldata, srcl->celldata,
srcl->cellsize * sizeof *dstl->celldata);
- }
+ } else
+ dstl->celldata = NULL;
sy++;
dy++;