Blob Blame History Raw
From c3bf9d981768bb1e96d73c9a001a6a77713a6245 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 10 Dec 2018 14:25:15 -0600
Subject: [PATCH] options: exit on a bad quoting regex, instead of crashing
 later

The paragraph-jumping functions used the regex unverified...

This fixes https://savannah.gnu.org/bugs/?55169.

Upstream-commit: 6e3b9ac0587243460c1f8a19d3fcc4402f98808d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 src/nano.c | 2 ++
 src/text.c | 5 -----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/nano.c b/src/nano.c
index 74e1243..1900d3e 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2486,6 +2486,8 @@ int main(int argc, char **argv)
 
 		quoteerr = charalloc(size);
 		regerror(quoterc, &quotereg, quoteerr, size);
+
+		die(_("Bad quoting regex \"%s\": %s\n"), quotestr, quoteerr);
 	}
 #endif /* ENABLE_JUSTIFY */
 
diff --git a/src/text.c b/src/text.c
index 8919916..6e730b6 100644
--- a/src/text.c
+++ b/src/text.c
@@ -2131,11 +2131,6 @@ bool find_paragraph(size_t *const quote, size_t *const par)
 	filestruct *current_save;
 		/* The line at the beginning of the paragraph we search for. */
 
-	if (quoterc != 0) {
-		statusline(ALERT, _("Bad quote string %s: %s"), quotestr, quoteerr);
-		return FALSE;
-	}
-
 	/* If we're at the end of the last line of the file, it means that
 	 * there aren't any paragraphs left, so get out. */
 	if (openfile->current == openfile->filebot && openfile->current_x ==
-- 
2.20.1