From 79912e7c2c8a2a0aec9fd8df133e389f2a5a658a Mon Sep 17 00:00:00 2001 From: renaud Date: Wed, 22 Apr 2026 15:54:08 +0000 Subject: [PATCH] vs_split() uses sp's visual map without checking it exists. OK millert --- usr.bin/vi/vi/vs_split.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.bin/vi/vi/vs_split.c b/usr.bin/vi/vi/vs_split.c index dc903d725ee..d5f063d6342 100644 --- a/usr.bin/vi/vi/vs_split.c +++ b/usr.bin/vi/vi/vs_split.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs_split.c,v 1.18 2026/04/20 10:30:02 tb Exp $ */ +/* $OpenBSD: vs_split.c,v 1.19 2026/04/22 15:54:08 renaud Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -43,6 +43,12 @@ vs_split(SCR *sp, SCR *new, int ccl) gp = sp->gp; + /* Source screen must have a visual map to split. */ + if (VIP(sp) == NULL || _HMAP(sp) == NULL) { + msgq(sp, M_ERR, "Not in visual mode: cannot split screen"); + return (1); + } + /* Check to see if it's possible. */ /* XXX: The IS_ONELINE fix will change this, too. */ if (sp->rows < 4) {