paste: fix crash with empty delimiter

reproduce:
	paste -d '' /dev/null
or
	paste -d '\0' /dev/null

show usage() in these cases.
This commit is contained in:
Hiltjo Posthuma 2015-03-30 21:25:23 +02:00
parent d6aff89bbb
commit 398598dbbe

View File

@ -109,6 +109,8 @@ main(int argc, char *argv[])
unescape(adelim);
delim = ereallocarray(NULL, utflen(adelim) + 1, sizeof(*delim));
len = utftorunestr(adelim, delim);
if (!len)
usage();
/* populate file list */
dsc = ereallocarray(NULL, argc, sizeof(*dsc));