Skip to content

Commit

Permalink
[Windows] Fix a range error in std.socket.SocketSet.add()
Browse files Browse the repository at this point in the history
`fds()` returns a slice of size `count()`, and since fds() is invoked
before evaluating the index expression (incl. increasing the count),
its length is the old count, so we cannot assign to the element at
index = old count, that's 1 past the end.
  • Loading branch information
kinke committed May 23, 2015
1 parent cb4dadf commit 86511b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion std/socket.d
Original file line number Diff line number Diff line change
Expand Up @@ -2236,7 +2236,8 @@ public:
set.length *= 2;
set.length = set.capacity;
}
fds[count++] = s;
++count;
fds[$-1] = s;
}
else
{
Expand Down

0 comments on commit 86511b3

Please sign in to comment.