projects
/
platform
/
upstream
/
coreutils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7c062d9
)
`od -c -w9999999' could segfault
author
Jim Meyering
<jim@meyering.net>
Tue, 18 Nov 2003 16:17:00 +0000
(16:17 +0000)
committer
Jim Meyering
<jim@meyering.net>
Tue, 18 Nov 2003 16:17:00 +0000
(16:17 +0000)
(dump): Use xnmalloc/free, not alloca.
src/od.c
patch
|
blob
|
history
diff --git
a/src/od.c
b/src/od.c
index
c68d40b
..
5dd9d9f
100644
(file)
--- a/
src/od.c
+++ b/
src/od.c
@@
-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;
}