diff options
author | Jim Meyering <jim@meyering.net> | 2003-11-18 16:17:00 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-11-18 16:17:00 +0000 |
commit | 02fbbc8ea26882d6ae46099cb8fc7fee73efb25e (patch) | |
tree | b66489b08e4d356217c14f6f27866f4b234916f6 | |
parent | 7c062d9fee0be4cb2daa2366405cf841d97d5472 (diff) | |
download | coreutils-02fbbc8ea26882d6ae46099cb8fc7fee73efb25e.tar.xz |
`od -c -w9999999' could segfault
(dump): Use xnmalloc/free, not alloca.
-rw-r--r-- | src/od.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1421,8 +1421,8 @@ dump (void) int err; size_t n_bytes_read; - block[0] = alloca (bytes_per_block); - block[1] = alloca (bytes_per_block); + block[0] = xnmalloc (2, bytes_per_block); + block[1] = block[0] + bytes_per_block; current_offset = n_bytes_to_skip; @@ -1487,6 +1487,8 @@ dump (void) if (limit_bytes_to_format && current_offset >= end_offset) err |= check_and_close (0); + free (block[0]); + return err; } |