st
simple terminal
git clone https://9o.is/git/st.git
commit 6607e4cf42b96c8266161ded8b5e7cdc89da37cf parent 59baf9cdcc6b04648edd36535fc32f9ba8283d00 Author: sin <sin@2f30.org> Date: Wed, 15 Apr 2015 09:43:06 +0100 Fix memmove() invocation with src/dst being NULL This fixes a segmentation fault on some systems. Diffstat:
| M | st.c | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/st.c b/st.c @@ -2788,8 +2788,11 @@ tresize(int col, int row) { free(term.line[i]); free(term.alt[i]); } - memmove(term.line, term.line + i, row * sizeof(Line)); - memmove(term.alt, term.alt + i, row * sizeof(Line)); + /* ensure that both src and dst are not NULL */ + if (i > 0) { + memmove(term.line, term.line + i, row * sizeof(Line)); + memmove(term.alt, term.alt + i, row * sizeof(Line)); + } for(i += row; i < term.row; i++) { free(term.line[i]); free(term.alt[i]);