* src/dd.c: Detect some very unlikely buffer overflows.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 13 Sep 2005 22:43:11 +0000 (22:43 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 13 Sep 2005 22:43:11 +0000 (22:43 +0000)
commit36081fa6358527fcec93c8df3f3a8cfbf0b72208
tree48854bfab86743d0317ec7d3fa3e0cb35eaa7b77
parent360b98042fa20a4418371cb91ad0d881c6d3762d
* src/dd.c: Detect some very unlikely buffer overflows.
(INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP): New macros.
(MAX_BLOCKSIZE): Now accepts an arg.  All uses changed.
(page_size): New var.
(scanargs, skip, main): Use more-straightforward way to detect overflow.
(dd_copy): Use page_size rather than invoking getpagesize.
Use INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP.
(main): Set page_size.
Avoid a call to stat in the usual case where ftruncate succeeds.
ChangeLog
src/dd.c