commit d90ba15f2990d7dc06d7c0c7877079e1f8dd3464
Author: Pieter Kockx <[email protected]>
AuthorDate: Thu Sep 7 19:00:10 2017 +0200
Commit: Michael Forney <[email protected]>
CommitDate: Thu Sep 7 22:58:24 2017 -0700
Fix segmentation fault in paste(1)
libutil/unescape received a pointer to a a string in
read-only memory.
diff --git a/paste.c b/paste.c
index 1d4e9f6..b0ac761 100644
--- a/paste.c
+++ b/paste.c
@@ -97,6 +97,7 @@ main(int argc, char *argv[])
break;
case 'd':
adelim = EARGF(usage());
+ unescape(adelim);
break;
default:
usage();
@@ -107,7 +108,6 @@ main(int argc, char *argv[])
/* populate delimiters */
/* TODO: fix libutf to accept sizes */
- unescape(adelim);
delim = ereallocarray(NULL, utflen(adelim) + 1, sizeof(*delim));
if (!(delimlen = utftorunestr(adelim, delim)))
usage();