diff options
-rw-r--r-- | source4/lib/tls/tls_tstream.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source4/lib/tls/tls_tstream.c b/source4/lib/tls/tls_tstream.c index e1137571a5..09fe5714eb 100644 --- a/source4/lib/tls/tls_tstream.c +++ b/source4/lib/tls/tls_tstream.c @@ -305,12 +305,17 @@ static ssize_t tstream_tls_pull_function(gnutls_transport_ptr ptr, } if (tlss->pull.iov.iov_base) { + uint8_t *b; size_t n; + b = (uint8_t *)tlss->pull.iov.iov_base; + n = MIN(tlss->pull.iov.iov_len, size); - memcpy(buf, tlss->pull.iov.iov_base, n); + memcpy(buf, b, n); tlss->pull.iov.iov_len -= n; + b += n; + tlss->pull.iov.iov_base = (char *)b; if (tlss->pull.iov.iov_len == 0) { tlss->pull.iov.iov_base = NULL; } |