Fix segmentation fault in paste(1)

libutil/unescape received a pointer to a a string in
read-only memory.
This commit is contained in:
Pieter Kockx 2017-09-07 19:00:10 +02:00 committed by Michael Forney
parent fb936d5ba5
commit d90ba15f29

View File

@ -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();