aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authornicm <nicm>2015-08-24 22:49:13 +0000
committernicm <nicm>2015-08-24 22:49:13 +0000
commit3219e0314e3d1d39a57db330faa5693ce0264244 (patch)
treeaac9af749f8cda1fe1291945fc248b732fd33c69 /grid.c
parent58b659a26e3c558614155ba351e7f275f277e4d3 (diff)
downloadrtmux-3219e0314e3d1d39a57db330faa5693ce0264244.tar.gz
rtmux-3219e0314e3d1d39a57db330faa5693ce0264244.tar.bz2
rtmux-3219e0314e3d1d39a57db330faa5693ce0264244.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 'grid.c')
-rw-r--r--grid.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/grid.c b/grid.c
index 7e086143..c339cdc5 100644
--- a/grid.c
+++ b/grid.c
@@ -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++;