summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Crequy <alban.crequy@collabora.co.uk>2011-11-07 18:51:27 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-11-07 21:17:01 +0100
commit7fc8fa6464d305440fddab423079c76a915decc3 (patch)
tree49b615e555057d3d4c255ca7a296e2e83f9c31b0
parente89c53670aa2ac9f251066689de060f61b1a868d (diff)
downloadgnutls-7fc8fa6464d305440fddab423079c76a915decc3.tar.gz
gnutls_session_get_data: fix possible buffer overflow
The test to avoid the buffer overflow was always false because session_data_size was set at the wrong place. This problem has been introduced by this commit: |commit ad4ed44c65e753e6d3a00104c049dd81826ccbf3 |Author: Nikos Mavrogiannopoulos <nmav@gnutls.org> |Date: Mon Nov 7 22:24:48 2005 +0000 | | This is the initial commit in the 1.3 branch. Ported from the PSK branch: | * PSK ciphersuites have been added. | * The session resumption data are now system independent. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--lib/gnutls_session.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gnutls_session.c b/lib/gnutls_session.c
index 6a37f13c6d..4ab1ef5b3b 100644
--- a/lib/gnutls_session.c
+++ b/lib/gnutls_session.c
@@ -65,13 +65,13 @@ gnutls_session_get_data (gnutls_session_t session,
gnutls_assert ();
return ret;
}
- *session_data_size = psession.size;
if (psession.size > *session_data_size)
{
ret = GNUTLS_E_SHORT_MEMORY_BUFFER;
goto error;
}
+ *session_data_size = psession.size;
if (session_data != NULL)
memcpy (session_data, psession.data, psession.size);