Module Name:    src
Committed By:   martin
Date:           Mon Nov 18 18:13:13 UTC 2024

Modified Files:
        src/external/bsd/nvi/dist/regex [netbsd-10]: engine.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1010):

        external/bsd/nvi/dist/regex/engine.c: revision 1.4

Treat a non-existing line like an empty line for matching to avoid segfault.
Fixes PR 57630


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.40.1 src/external/bsd/nvi/dist/regex/engine.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/regex/engine.c
diff -u src/external/bsd/nvi/dist/regex/engine.c:1.3 src/external/bsd/nvi/dist/regex/engine.c:1.3.40.1
--- src/external/bsd/nvi/dist/regex/engine.c:1.3	Tue Jan  7 21:48:12 2014
+++ src/external/bsd/nvi/dist/regex/engine.c	Mon Nov 18 18:13:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: engine.c,v 1.3 2014/01/07 21:48:12 christos Exp $ */
+/*	$NetBSD: engine.c,v 1.3.40.1 2024/11/18 18:13:13 martin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
@@ -150,6 +150,11 @@ int eflags;
 	const sopno gl = g->laststate;
 	RCHAR_T *start;
 	RCHAR_T *stop;
+	RCHAR_T empty[] = { REOF };
+
+	/* Input can be a NULL pointer, treat like an empty line. */
+	if (string == NULL)
+		string = empty;
 
 	/* simplify the situation where possible */
 	if (g->cflags&REG_NOSUB)

Reply via email to