From: millert Date: Thu, 21 Apr 2022 17:50:29 +0000 (+0000) Subject: v_event_get: check qp->output for NULL before passing to e_memcmp(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=75290643f6f2a873a5f085ad876198b57485c398;p=openbsd 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@ --- 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);