diff options
| author | Brian Feldman <green@FreeBSD.org> | 2000-10-22 23:00:32 +0000 |
|---|---|---|
| committer | Brian Feldman <green@FreeBSD.org> | 2000-10-22 23:00:32 +0000 |
| commit | 53885065b712f85ecbce2b4752898823209b1c92 (patch) | |
| tree | 4cc08779dbb6975386a9e95fbea6d1b039dcaae1 /bin/dd | |
| parent | b608e3ff66a6e9c770f83a3ff38164add7e35715 (diff) | |
Notes
Diffstat (limited to 'bin/dd')
| -rw-r--r-- | bin/dd/args.c | 4 | ||||
| -rw-r--r-- | bin/dd/position.c | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/bin/dd/args.c b/bin/dd/args.c index e118712194ea..252f0fa3aa75 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -428,7 +428,7 @@ get_offset(val) quad_t num; num = get_num(val); - if (num > QUAD_MAX || num < 0) /* XXX quad_t != off_t */ - errx(1, "%s: illegal offset", oper); /* Too big/negative. */ + if (num > QUAD_MAX) /* XXX can't happen && quad_t != off_t */ + errx(1, "%s: illegal offset", oper); /* Too big. */ return ((off_t)num); } diff --git a/bin/dd/position.c b/bin/dd/position.c index 10020d0b2da6..1a9c4b1df9cc 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; |
