[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnutls-dev] [PATCH] bug in lib/gnutls_buffers.c

From: Sergey Poznyakoff
Subject: [gnutls-dev] [PATCH] bug in lib/gnutls_buffers.c
Date: Tue May 27 20:20:02 2003


The buffering mechanism in gnutls_buffers.c does not work when
the user-defined pull function is used. Here's the short

The comment to _gnutls_io_clear_peeked_data() states that `this
function is only used with berkeley style sockets.', however no
provision is made to ensure this is so. This causes the function
to be called even if the pull function is used. Now, what happens
is that calling _gnutls_io_clear_peeked_data() after
_gnutls_read(..., MSG_PEEK) blocks the program, since it actually
attempts to read the same data twice.

Attached is the patch that corrects the bug.


Index: lib/gnutls_buffers.c
RCS file: /cvs/gnutls/gnutls/lib/gnutls_buffers.c,v
retrieving revision 2.104
diff -p -u -r2.104 gnutls_buffers.c
--- lib/gnutls_buffers.c        24 Mar 2003 17:21:54 -0000      2.104
+++ lib/gnutls_buffers.c        27 May 2003 17:22:46 -0000
@@ -429,7 +429,8 @@ ssize_t _gnutls_io_read_buffered( gnutls
                if (ret2 > 0) {
                        _gnutls_read_log("RB-PEEK: Read %d bytes in PEEK 
MODE.\n", ret2); 
                        _gnutls_read_log("RB-PEEK: Have %d bytes into buffer. 
Adding %d bytes.\nRB: Requested %d bytes\n", 
session->internals.record_recv_buffer.length, ret2, sizeOfPtr);
-                       session->internals.have_peeked_data = 1;
+                       if (!session->internals._gnutls_pull_func) 
+                               session->internals.have_peeked_data = 1;
                        session->internals.record_recv_buffer.length += ret2;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]