summaryrefslogtreecommitdiffstats
path: root/usr.bin/bsdiff
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2015-11-03 17:27:24 +0000
committerache <ache@FreeBSD.org>2015-11-03 17:27:24 +0000
commitdb4536763e2d0f691d53ef7aef2dc45fbece3a86 (patch)
tree7daab7fcff9ca368bae74597d4dae944ff7bb82a /usr.bin/bsdiff
parent1973c3319be0f1ca6cfae86620e402d0cc9b4920 (diff)
downloadFreeBSD-src-db4536763e2d0f691d53ef7aef2dc45fbece3a86.zip
FreeBSD-src-db4536763e2d0f691d53ef7aef2dc45fbece3a86.tar.gz
Check for (old|new)size + 1 overflows off_t.
PR: 204230 MFC after: 1 week
Diffstat (limited to 'usr.bin/bsdiff')
-rw-r--r--usr.bin/bsdiff/bsdiff/bsdiff.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/bsdiff/bsdiff/bsdiff.c b/usr.bin/bsdiff/bsdiff/bsdiff.c
index db0bf69..7e39275 100644
--- a/usr.bin/bsdiff/bsdiff/bsdiff.c
+++ b/usr.bin/bsdiff/bsdiff/bsdiff.c
@@ -237,7 +237,8 @@ int main(int argc,char *argv[])
err(1, "%s", argv[1]);
if (oldsize > SSIZE_MAX ||
- (uintmax_t)oldsize >= SIZE_T_MAX / sizeof(off_t)) {
+ (uintmax_t)oldsize >= SIZE_T_MAX / sizeof(off_t) ||
+ oldsize == OFF_MAX) {
errno = EFBIG;
err(1, "%s", argv[1]);
}
@@ -260,7 +261,8 @@ int main(int argc,char *argv[])
((newsize=lseek(fd,0,SEEK_END))==-1))
err(1, "%s", argv[2]);
- if (newsize > SSIZE_MAX || (uintmax_t)newsize >= SIZE_T_MAX) {
+ if (newsize > SSIZE_MAX || (uintmax_t)newsize >= SIZE_T_MAX ||
+ newsize == OFF_MAX) {
errno = EFBIG;
err(1, "%s", argv[2]);
}
OpenPOWER on IntegriCloud