Skip to content

Commit

Permalink
Fix broken overflow check in posix_fallocate [BZ 18873]
Browse files Browse the repository at this point in the history
* sysdeps/posix/posix_fallocate.c (posix_fallocate):
* sysdeps/posix/posix_fallocate64.c (__posix_fallocate64_l64):
Fix parenthesization typo.
  • Loading branch information
Paul Eggert authored and Florian Weimer committed Aug 31, 2015
1 parent 3f563e9 commit 543ef57
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2015-08-31 Paul Eggert <eggert@cs.ucla.edu>

[BZ #18873]
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.

2015-08-28 Mike Frysinger <vapier@gentoo.org>

[BZ #18887]
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Version 2.23
2898, 14341, 15786, 16141, 16517, 16519, 16520, 16734, 16973, 17787,
17905, 18084, 18086, 18240, 18265, 18370, 18421, 18480, 18525, 18610,
18618, 18647, 18661, 18674, 18681, 18778, 18781, 18787, 18789, 18790,
18795, 18796, 18820, 18823, 18824, 18863, 18887.
18795, 18796, 18820, 18823, 18824, 18863, 18873, 18887.

* The obsolete header <regexp.h> has been removed. Programs that require
this header must be updated to use <regex.h> instead.
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/posix/posix_fallocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion sysdeps/posix/posix_fallocate64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 543ef57

Please sign in to comment.