diff options
Diffstat (limited to 'source3/lib/messages_ctdbd.c')
-rw-r--r-- | source3/lib/messages_ctdbd.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c index 59f5976da0..53aeb1fd05 100644 --- a/source3/lib/messages_ctdbd.c +++ b/source3/lib/messages_ctdbd.c @@ -100,16 +100,23 @@ static int messaging_ctdb_send(struct server_id src, backend->private_data, struct messaging_ctdbd_context); struct messaging_rec msg; uint8_t *buf; + ssize_t buflen; NTSTATUS status; if (num_fds > 0) { return ENOSYS; } - buf = iov_buf(talloc_tos(), iov, iovlen); - if (buf == NULL) { + buflen = iov_buflen(iov, iovlen); + if (buflen == -1) { + return EMSGSIZE; + } + + buf = talloc_array(talloc_tos(), uint8_t, buflen); + if (buflen == NULL) { return ENOMEM; } + iov_buf(iov, iovlen, buf, buflen); msg = (struct messaging_rec) { .msg_version = MESSAGE_VERSION, |