diff options
author | 2019-08-07 04:22:16 +0000 | |
---|---|---|
committer | 2019-08-07 04:22:16 +0000 | |
commit | 2853db30ff25a0f016d8c87b76b7158a12e9df9c (patch) | |
tree | b35cb96c42ee189a1509738bf47a7d1bf42061d1 /lib/libedit/terminal.c | |
parent | When we needed the kernel lock for local IP packet delivery, mpi@ (diff) | |
download | wireguard-openbsd-2853db30ff25a0f016d8c87b76b7158a12e9df9c.tar.xz wireguard-openbsd-2853db30ff25a0f016d8c87b76b7158a12e9df9c.zip |
Initialize the line buffer by zero when allocation. This fixes the
problem a crash happens after the window size change.
Worked and discussed with asou and schwarze.
ok schwarze
Diffstat (limited to 'lib/libedit/terminal.c')
-rw-r--r-- | lib/libedit/terminal.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libedit/terminal.c b/lib/libedit/terminal.c index 638997b1083..a2feda87985 100644 --- a/lib/libedit/terminal.c +++ b/lib/libedit/terminal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: terminal.c,v 1.18 2017/04/12 18:24:37 tb Exp $ */ +/* $OpenBSD: terminal.c,v 1.19 2019/08/07 04:22:16 yasuoka Exp $ */ /* $NetBSD: terminal.c,v 1.17 2016/02/15 15:35:03 christos Exp $ */ /*- @@ -413,11 +413,11 @@ terminal_alloc_display(EditLine *el) wchar_t **b; coord_t *c = &el->el_terminal.t_size; - b = reallocarray(NULL, c->v + 1, sizeof(*b)); + b = calloc(c->v + 1, sizeof(*b)); if (b == NULL) goto done; for (i = 0; i < c->v; i++) { - b[i] = reallocarray(NULL, c->h + 1, sizeof(**b)); + b[i] = calloc(c->h + 1, sizeof(**b)); if (b[i] == NULL) { while (--i >= 0) free(b[i]); @@ -428,11 +428,11 @@ terminal_alloc_display(EditLine *el) b[c->v] = NULL; el->el_display = b; - b = reallocarray(NULL, c->v + 1, sizeof(*b)); + b = calloc(c->v + 1, sizeof(*b)); if (b == NULL) goto done; for (i = 0; i < c->v; i++) { - b[i] = reallocarray(NULL, c->h + 1, sizeof(**b)); + b[i] = calloc(c->h + 1, sizeof(**b)); if (b[i] == NULL) { while (--i >= 0) free(b[i]); |