commit 398598dbbe5e533ca10d93c690becaa66f589b75
Author: Hiltjo Posthuma <[email protected]>
Date: Mon Mar 30 21:25:23 2015 +0200
paste: fix crash with empty delimiter
reproduce:
paste -d '' /dev/null
or
paste -d '\0' /dev/null
show usage() in these cases.
diff --git a/paste.c b/paste.c
index f90f37f..5ccda3a 100644
--- a/paste.c
+++ b/paste.c
@@ -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));