Skip to content
This repository has been archived by the owner on Jul 25, 2019. It is now read-only.

Commit

Permalink
Fixed overflow issue with available()
Browse files Browse the repository at this point in the history
  • Loading branch information
ladyada committed Jun 1, 2011
1 parent 95ecca5 commit 64d1e07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ int File::read(void *buf, uint16_t nbyte) {

int File::available() {
if (! _file) return 0;
return size() - position();

uint32_t n = size() - position();

return n > 0X7FFF ? 0X7FFF : n;
}

void File::flush() {
Expand Down

0 comments on commit 64d1e07

Please sign in to comment.