diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2020-07-22 13:22:54 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2020-07-22 13:22:54 +0000 |
commit | 0bdb4abd39da748531cd5caf59434d40c2630c71 (patch) | |
tree | 95832169127fb004a513d1e790a4f4defe2a4d8a /usr.bin | |
parent | c589064b89c824ccb7a03192ad98155660f458b6 (diff) |
Prevent mg segfault with query-replace-regex replacing ^
Patch from Mark Willson with a minor tweak
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/line.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c index 4e4f5248738..527893b119f 100644 --- a/usr.bin/mg/line.c +++ b/usr.bin/mg/line.c @@ -1,4 +1,4 @@ -/* $OpenBSD: line.c,v 1.61 2018/08/29 07:50:16 reyk Exp $ */ +/* $OpenBSD: line.c,v 1.62 2020/07/22 13:22:53 tb Exp $ */ /* This file is in the public domain. */ @@ -556,6 +556,8 @@ lreplace(RSIZE plen, char *st) goto done; lp = curwp->w_dotp; + if (ltext(lp) == NULL) + goto done; doto = curwp->w_doto; n = plen; |