diff options
author | green <green@FreeBSD.org> | 2000-10-22 23:00:32 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2000-10-22 23:00:32 +0000 |
commit | aa2e16431f81c11561492c59548f84873b57ae1e (patch) | |
tree | 7d146375703445b82bfd0df3d089f37cb9fb2e88 /bin/dd/position.c | |
parent | e3a7d71c8203c4a03e4a1346f836d97aaf6c0def (diff) | |
download | FreeBSD-src-aa2e16431f81c11561492c59548f84873b57ae1e.zip FreeBSD-src-aa2e16431f81c11561492c59548f84873b57ae1e.tar.gz |
Allow negative seek offsets for files that can be seeked upon. It
makes dd(1) a more complete "filter", even if this functionality is
limited to seekable streams.
Diffstat (limited to 'bin/dd/position.c')
-rw-r--r-- | bin/dd/position.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/dd/position.c b/bin/dd/position.c index 10020d0..1a9c4b1 100644 --- a/bin/dd/position.c +++ b/bin/dd/position.c @@ -76,6 +76,10 @@ pos_in() return; } + /* Don't try to read a really weird amount (like negative). */ + if (in.offset < 0) + errx(1, "%s: illegal offset", "iseek/skip"); + /* * Read the data. If a pipe, read until satisfy the number of bytes * being skipped. No differentiation for reading complete and partial @@ -138,6 +142,10 @@ pos_out() return; } + /* Don't try to read a really weird amount (like negative). */ + if (out.offset < 0) + errx(1, "%s: illegal offset", "oseek/seek"); + /* If no read access, try using mtio. */ if (out.flags & NOREAD) { t_op.mt_op = MTFSR; |