From 543ef578c3304661713950b37abd0c916f52ecf0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 25 Aug 2015 23:42:01 -0700 Subject: Fix broken overflow check in posix_fallocate [BZ 18873] * sysdeps/posix/posix_fallocate.c (posix_fallocate): * sysdeps/posix/posix_fallocate64.c (__posix_fallocate64_l64): Fix parenthesization typo. --- sysdeps/posix/posix_fallocate.c | 2 +- sysdeps/posix/posix_fallocate64.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sysdeps/posix') diff --git a/sysdeps/posix/posix_fallocate.c b/sysdeps/posix/posix_fallocate.c index e7fe201b68..d0479a6ee5 100644 --- a/sysdeps/posix/posix_fallocate.c +++ b/sysdeps/posix/posix_fallocate.c @@ -37,7 +37,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len) /* Perform overflow check. The outer cast relies on a GCC extension. */ - if ((__off_t) ((uint64_t) offset) + ((uint64_t) len) < 0) + if ((__off_t) ((uint64_t) offset + (uint64_t) len) < 0) return EFBIG; /* pwrite below will not do the right thing in O_APPEND mode. */ diff --git a/sysdeps/posix/posix_fallocate64.c b/sysdeps/posix/posix_fallocate64.c index ee32679a05..fb2dac6e13 100644 --- a/sysdeps/posix/posix_fallocate64.c +++ b/sysdeps/posix/posix_fallocate64.c @@ -37,7 +37,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len) /* Perform overflow check. The outer cast relies on a GCC extension. */ - if ((__off64_t) ((uint64_t) offset) + ((uint64_t) len) < 0) + if ((__off64_t) ((uint64_t) offset + (uint64_t) len) < 0) return EFBIG; /* pwrite64 below will not do the right thing in O_APPEND mode. */ -- cgit 1.4.1