summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-03-03 21:02:55 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-03-03 21:02:55 +0100
commit601159e8e25028155a86de2e5fdf55c9402936d7 (patch)
treee38dda424dce86f6cb5603e36da9775a42fb922a /src/network
parentdb6ea52b44b2e6f2c03c818ffa94af93976f78c5 (diff)
downloadbiboumi-601159e8e25028155a86de2e5fdf55c9402936d7.tar.gz
biboumi-601159e8e25028155a86de2e5fdf55c9402936d7.tar.bz2
biboumi-601159e8e25028155a86de2e5fdf55c9402936d7.tar.xz
biboumi-601159e8e25028155a86de2e5fdf55c9402936d7.zip
Fix a bus error by not going above an array boundary
Diffstat (limited to 'src/network')
-rw-r--r--src/network/socket_handler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/socket_handler.cpp b/src/network/socket_handler.cpp
index eb427b8..d774927 100644
--- a/src/network/socket_handler.cpp
+++ b/src/network/socket_handler.cpp
@@ -183,7 +183,8 @@ void SocketHandler::on_send()
// unconsting the content of s is ok, sendmsg will never modify it
msg_iov[msg.msg_iovlen].iov_base = const_cast<char*>(s.data());
msg_iov[msg.msg_iovlen].iov_len = s.size();
- msg.msg_iovlen++;
+ if (++msg.msg_iovlen == UIO_FASTIOV)
+ break;
}
ssize_t res = ::sendmsg(this->socket, &msg, MSG_NOSIGNAL);
if (res < 0)