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:
parent
d6aff89bbb
commit
398598dbbe
2
paste.c
2
paste.c
@ -109,6 +109,8 @@ main(int argc, char *argv[])
|
|||||||
unescape(adelim);
|
unescape(adelim);
|
||||||
delim = ereallocarray(NULL, utflen(adelim) + 1, sizeof(*delim));
|
delim = ereallocarray(NULL, utflen(adelim) + 1, sizeof(*delim));
|
||||||
len = utftorunestr(adelim, delim);
|
len = utftorunestr(adelim, delim);
|
||||||
|
if (!len)
|
||||||
|
usage();
|
||||||
|
|
||||||
/* populate file list */
|
/* populate file list */
|
||||||
dsc = ereallocarray(NULL, argc, sizeof(*dsc));
|
dsc = ereallocarray(NULL, argc, sizeof(*dsc));
|
||||||
|
Loading…
Reference in New Issue
Block a user