diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-12-14 15:00:15 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-01-18 16:34:28 +0100 |
commit | 361b4ed016a06717682e4071aa499a52b6c29dda (patch) | |
tree | 37a6d1abd8eec1d7aa48a07b90b2740af278b062 | |
parent | f6077f23b773d521938539fe142cd2675c3978b3 (diff) | |
download | samba-361b4ed016a06717682e4071aa499a52b6c29dda.tar.gz samba-361b4ed016a06717682e4071aa499a52b6c29dda.tar.bz2 samba-361b4ed016a06717682e4071aa499a52b6c29dda.zip |
s4:tls_tstream: fix partial reads, so that the gnutls layer doesn't read the same data twice
metze
-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; } |