This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix broken overflow check in posix_fallocate
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: libc-alpha at sourceware dot org
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>
- Date: Tue, 25 Aug 2015 23:42:01 -0700
- Subject: [PATCH] Fix broken overflow check in posix_fallocate
- Authentication-results: sourceware.org; auth=none
* sysdeps/posix/posix_fallocate.c (posix_fallocate):
* sysdeps/posix/posix_fallocate64.c (__posix_fallocate64_l64):
Fix parenthesization typo.
---
ChangeLog | 5 +++++
sysdeps/posix/posix_fallocate.c | 2 +-
sysdeps/posix/posix_fallocate64.c | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bd6d027..458b850 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-08-25 Paul Eggert <eggert@cs.ucla.edu>
+ Fix broken overflow check in posix_fallocate
+ * sysdeps/posix/posix_fallocate.c (posix_fallocate):
+ * sysdeps/posix/posix_fallocate64.c (__posix_fallocate64_l64):
+ Fix parenthesization typo.
+
Fix memory leak in printf_positional
* stdio-common/vfprintf.c (printf_positional):
Free temporary data allocated via malloc.
diff --git a/sysdeps/posix/posix_fallocate.c b/sysdeps/posix/posix_fallocate.c
index e7fe201..d0479a6 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 ee32679..fb2dac6 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. */
--
2.1.0