diff options
Diffstat (limited to 'bin/dd/position.c')
| -rw-r--r-- | bin/dd/position.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/dd/position.c b/bin/dd/position.c index 71153f04fe6a..d816716456fe 100644 --- a/bin/dd/position.c +++ b/bin/dd/position.c @@ -70,7 +70,7 @@ seek_offset(IO *io) * * Bail out if the calculation of a file offset would overflow. */ - if ((io->flags & ISCHR) == 0 && n > OFF_MAX / (ssize_t)sz) + if ((io->flags & ISCHR) == 0 && (n < 0 || n > OFF_MAX / (ssize_t)sz)) errx(1, "seek offsets cannot be larger than %jd", (intmax_t)OFF_MAX); else if ((io->flags & ISCHR) != 0 && (uint64_t)n > UINT64_MAX / sz) |
