diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2022-04-21 17:50:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2022-04-21 17:50:30 +0000 |
commit | 4588bca5ee4f8b297c376ac6655b53ecceaf7073 (patch) | |
tree | 39fe7749d67a9e45233032f16185b92c14431daf /usr.bin/vi/common | |
parent | b2e71f0b62be8515b77fbaaca09ab9c2fa104241 (diff) |
v_event_get: check qp->output for NULL before passing to e_memcmp().
Other users of qp->output already include a NULL check.
Avoids a crash when cursor key support is disabled in cl/cl_term.c.
From Jeremy Mates. OK tb@
Diffstat (limited to 'usr.bin/vi/common')
-rw-r--r-- | usr.bin/vi/common/key.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/vi/common/key.c b/usr.bin/vi/common/key.c index e3a85e2e7f7..8b14269c598 100644 --- a/usr.bin/vi/common/key.c +++ b/usr.bin/vi/common/key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key.c,v 1.19 2017/04/18 01:45:35 deraadt Exp $ */ +/* $OpenBSD: key.c,v 1.20 2022/04/21 17:50:29 millert Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -650,7 +650,10 @@ not_digit: argp->e_c = CH_NOT_DIGIT; } /* Find out if the initial segments are identical. */ - init_nomap = !e_memcmp(qp->output, &gp->i_event[gp->i_next], qp->ilen); + if (qp->output != NULL) { + init_nomap = + !e_memcmp(qp->output, &gp->i_event[gp->i_next], qp->ilen); + } /* Delete the mapped characters from the queue. */ QREM(qp->ilen); |