Module Name: src Committed By: mlelstv Date: Sun Nov 10 10:54:29 UTC 2024
Modified Files: src/external/bsd/nvi/dist/regex: engine.c Log Message: 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.4 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.4 --- 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 Sun Nov 10 10:54:29 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: engine.c,v 1.3 2014/01/07 21:48:12 christos Exp $ */ +/* $NetBSD: engine.c,v 1.4 2024/11/10 10:54:29 mlelstv 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®_NOSUB)