diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-03-26 19:29:49 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-03-26 19:29:49 +0000 |
| commit | 4f2554b7b7ee236ead2b2be8a84a22402993ff60 (patch) | |
| tree | 082e07f9795560f59630c73c1290c9594db5b46a /usr.bin | |
| parent | 5a17403d430a1738cd63414111e1a59a81e9e54e (diff) | |
Notes
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/tail/forward.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index e25e0d60a749..f63b410dcb23 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -274,10 +274,17 @@ rlines(fp, off, sbp) if (!(size = sbp->st_size)) return; - if (size > SIZE_T_MAX) { + if (size > SIZE_T_MAX || size < 0) { errno = EFBIG; ierr(); - return; + exit(1); + } + + /* XXX: FIXME - mmap() not support files over 2Gb */ + if (size > INT_MAX) { + errno = EFBIG; + ierr(); + exit(1); } if ((start = mmap(NULL, (size_t)size, @@ -296,7 +303,7 @@ rlines(fp, off, sbp) /* Set the file pointer to reflect the length displayed. */ size = sbp->st_size - size; WR(p, size); - if (fseek(fp, (long)sbp->st_size, SEEK_SET) == -1) { + if (fseek(fp, 0L, SEEK_END) == -1) { ierr(); return; } |
