mirror of
https://github.com/tmux/tmux.git
synced 2025-01-22 05:37:07 +00:00
Use xrealloc(NULL, n, m) instead of xmalloc(n * m) to get overflow
check.
This commit is contained in:
parent
6610e89689
commit
77efcf8bdd
3
grid.c
3
grid.c
@ -724,7 +724,8 @@ grid_reflow_split(struct grid *dst, u_int *py, struct grid_line *src_gl,
|
|||||||
to_copy = src_gl->cellsize;
|
to_copy = src_gl->cellsize;
|
||||||
|
|
||||||
/* Expand destination line. */
|
/* 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->cellsize = to_copy;
|
||||||
dst_gl->flags |= GRID_LINE_WRAPPED;
|
dst_gl->flags |= GRID_LINE_WRAPPED;
|
||||||
|
|
||||||
|
2
paste.c
2
paste.c
@ -279,7 +279,7 @@ paste_make_sample(struct paste_buffer *pb, int utf8flag)
|
|||||||
len = pb->size;
|
len = pb->size;
|
||||||
if (len > width)
|
if (len > width)
|
||||||
len = width;
|
len = width;
|
||||||
buf = xmalloc(len * 4 + 4);
|
buf = xrealloc(NULL, len, 4 + 4);
|
||||||
|
|
||||||
if (utf8flag)
|
if (utf8flag)
|
||||||
used = utf8_strvis(buf, pb->data, len, flags);
|
used = utf8_strvis(buf, pb->data, len, flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user