diff options
author | bde <bde@FreeBSD.org> | 1997-12-11 07:27:06 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-12-11 07:27:06 +0000 |
commit | 52b8e9813edc79062fd4253339febac539c7bfba (patch) | |
tree | a8ac214281d2033248c4f8c09dde9df6ee06109e /usr.sbin/bad144 | |
parent | ac983318f52dbd430be851fd99e3dc125f2b2d39 (diff) | |
download | FreeBSD-src-52b8e9813edc79062fd4253339febac539c7bfba.zip FreeBSD-src-52b8e9813edc79062fd4253339febac539c7bfba.tar.gz |
Fixed the usual multiplication overflow bug in an lseek() offset calculation.
The scan for bad sectors was broken for offsets >= 4G on 32-bit systems.
Diffstat (limited to 'usr.sbin/bad144')
-rw-r--r-- | usr.sbin/bad144/bad144.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/bad144/bad144.c b/usr.sbin/bad144/bad144.c index 80e2dfc..61c9cd1 100644 --- a/usr.sbin/bad144/bad144.c +++ b/usr.sbin/bad144/bad144.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)bad144.c 8.2 (Berkeley) 4/27/95"; #endif static const char rcsid[] = - "$Id: bad144.c,v 1.13 1997/09/04 11:40:51 charnier Exp $"; + "$Id: bad144.c,v 1.14 1997/12/11 07:12:10 bde Exp $"; #endif /* not lint */ /* @@ -144,7 +144,8 @@ bad_scan(argc, argv, dp, f, bstart, bend) curr_sec,bend,(curr_sec*100/bend)); } - lseek(f, curr_sec * ss, L_SET); + if (lseek(f, (off_t)ss * curr_sec, SEEK_SET) < 0) + err(4, "lseek"); if ((n = read(f, buf, ss)) != ss) { if (verbose) |