summaryrefslogtreecommitdiff
path: root/src/wc.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-03-02 18:54:43 +0100
committerJim Meyering <meyering@redhat.com>2011-03-03 09:01:17 +0100
commit7cfd12c78e0be4c90f29c99ab383163aa1471504 (patch)
treefedfcb74dc902d31a6f7d27bc2c76838ff10d244 /src/wc.c
parenta132e03507871f9506940d3cdf82faa072d861bf (diff)
downloadcoreutils-7cfd12c78e0be4c90f29c99ab383163aa1471504.tar.xz
wc: avoid NULL dereference on out-of-memory error
* src/wc.c (main): Diagnose failed argv_iter_init_* failure, rather than falling through and dereferencing NULL. Bug introduced by 2008-11-25 commit c2e56e0d, "wc: read and process --files0-from= input a name at a time,". * NEWS (Bug fixes): Mention it.
Diffstat (limited to 'src/wc.c')
-rw-r--r--src/wc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wc.c b/src/wc.c
index 3afd4deab..ccf4ccfbc 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -709,6 +709,9 @@ main (int argc, char **argv)
ai = argv_iter_init_argv (files);
}
+ if (!ai)
+ xalloc_die ();
+
fstatus = get_input_fstatus (nfiles, files);
number_width = compute_number_width (nfiles, fstatus);