From: Bartosz Golaszewski Date: Fri, 7 Mar 2014 10:46:03 +0000 (+0100) Subject: shuf: fix a segfault on 'shuf -e' X-Git-Tag: 1_23_0~162 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=58adbb5505d0c643c18d956934aa8afa18e612eb;p=oweals%2Fbusybox.git shuf: fix a segfault on 'shuf -e' Signed-off-by: Bartosz Golaszewski Signed-off-by: Denys Vlasenko --- diff --git a/coreutils/shuf.c b/coreutils/shuf.c index f213d6759..648a4abbb 100644 --- a/coreutils/shuf.c +++ b/coreutils/shuf.c @@ -126,7 +126,8 @@ int shuf_main(int argc, char **argv) fclose_if_not_stdin(fp); } - shuffle_lines(lines, numlines); + if (numlines != 0) + shuffle_lines(lines, numlines); if (opts & OPT_o) xmove_fd(xopen(opt_o_str, O_WRONLY|O_CREAT|O_TRUNC), STDOUT_FILENO);