summaryrefslogtreecommitdiff
path: root/lib/gnutls_session.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2005-11-30 12:01:45 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2005-11-30 12:01:45 +0000
commitbd6a8bd6903c2cabfbf198426ee0c7bab0bf3ddf (patch)
treee1b87b6a521147eaaff091565b53493ecfac1644 /lib/gnutls_session.c
parent8f32a3b7512c44b4aa09386ff24f5fd9c9393b4a (diff)
downloadgnutls-bd6a8bd6903c2cabfbf198426ee0c7bab0bf3ddf.tar.gz
Some fixes in session resumption and prototypes. Based on patches and suggestions by Joe Orton.
Diffstat (limited to 'lib/gnutls_session.c')
-rw-r--r--lib/gnutls_session.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gnutls_session.c b/lib/gnutls_session.c
index 7a285e29a5..edded34215 100644
--- a/lib/gnutls_session.c
+++ b/lib/gnutls_session.c
@@ -120,11 +120,14 @@ gnutls_session_get_data2 (gnutls_session_t session, gnutls_datum * data)
*
* Session id is some data set by the server, that identify the current session.
* In TLS 1.0 and SSL 3.0 session id is always less than 32 bytes.
+ *
+ * Returns zero on success.
**/
int
gnutls_session_get_id (gnutls_session_t session,
void *session_id, size_t * session_id_size)
{
+size_t given_session_id_size = *session_id_size;
*session_id_size = session->security_parameters.session_id_size;
@@ -133,6 +136,12 @@ gnutls_session_get_id (gnutls_session_t session,
{
return 0;
}
+
+ if ( given_session_id_size < session->security_parameters.session_id_size)
+ {
+ return GNUTLS_E_SHORT_MEMORY_BUFFER;
+ }
+
memcpy (session_id, &session->security_parameters.session_id,
*session_id_size);