Files
alcove/c_src
Michael Santos c91307c102 alcove_write: fix end of array check
This code looked fishy to me but I couldn't pinpoint why and it worked on
Ubuntu 12.04/armv7l, Ubuntu 12.04/amd64, OpenBSD 5.5/amd64 and FreeBSD
10/amd64. I forgot to test on Ubuntu 14.04/amd64 of course and
thankfully it failed there.

The code compares the number of bytes written by writev against each of
the iov_len fields in the iovec array and decrements the value
accordingly. So an iovec array that looks like:

    iov[0].iov_len = 4
    iov[1].iov_len = 6

    number of bytes written = 10 bytes

Would be computed as follows:

    count = 2

    0: 10 >= iov[0].iov_len (4) -> 6
    1: 6 >= iov[1].iov_len (6) -> 0
    2: 0 >= iov[2].iov_len (undefined) -> ???
    3: ...

Limit iteration to the size of the iovec array. Although this commit fixes
this issue, this code should either be further simplified or re-written.
2014-07-30 14:29:01 -04:00
..
2014-06-27 10:25:29 -04:00
2014-07-30 14:29:01 -04:00
2014-07-28 10:57:13 -04:00