Hello hackers

Get a segfault by typing:
paste blabla

It seems wise to scrutinize other calls to unescape() as well.

-- Pieter
From 45c61280dc1ef9e5692e2b570f6e191bfe4c9906 Mon Sep 17 00:00:00 2001
From: Pieter Kockx <[email protected]>
Date: Thu, 7 Sep 2017 19:00:10 +0200
Subject: [PATCH] Fix segmentation fault in paste(1)

libutil/unescape received a pointer to a a string in
read-only memory.
---
 paste.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/paste.c b/paste.c
index 1d4e9f6..9caff61 100644
--- a/paste.c
+++ b/paste.c
@@ -89,7 +89,9 @@ main(int argc, char *argv[])
 	Rune *delim;
 	size_t delimlen, i;
 	int seq = 0, ret = 0;
-	char *adelim = "\t";
+	char *adelim;
+
+	adelim = estrdup("\t");
 
 	ARGBEGIN {
 	case 's':
-- 
2.13.5

Reply via email to