summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/gnutls/gnutls.h.in12
-rw-r--r--lib/gnutls_session.c9
-rw-r--r--lib/gnutls_session_pack.c2
3 files changed, 18 insertions, 5 deletions
diff --git a/includes/gnutls/gnutls.h.in b/includes/gnutls/gnutls.h.in
index b10eec05ed..8b60c19655 100644
--- a/includes/gnutls/gnutls.h.in
+++ b/includes/gnutls/gnutls.h.in
@@ -326,6 +326,8 @@ const char *gnutls_protocol_get_name(gnutls_protocol_t version);
*/
int gnutls_session_set_data( gnutls_session_t session, const void* session_data, size_t session_data_size);
int gnutls_session_get_data( gnutls_session_t session, void* session_data, size_t *session_data_size);
+int gnutls_session_get_data2( gnutls_session_t session, gnutls_datum* data);
+
/* returns the session ID */
#define GNUTLS_MAX_SESSION_ID 32
int gnutls_session_get_id( gnutls_session_t session, void* session_id, size_t *session_id_size);
@@ -450,11 +452,11 @@ typedef void (*gnutls_free_function)(void*);
typedef void* (*gnutls_realloc_function)(void*, size_t);
extern void
-gnutls_global_set_mem_functions(gnutls_alloc_function alloc_func,
- gnutls_alloc_function secure_alloc_func,
- gnutls_is_secure_function is_secure_func,
- gnutls_realloc_function realloc_func,
- gnutls_free_function free_func);
+gnutls_global_set_mem_functions(gnutls_alloc_function gt_alloc_func,
+ gnutls_alloc_function gt_secure_alloc_func,
+ gnutls_is_secure_function gt_is_secure_func,
+ gnutls_realloc_function gt_realloc_func,
+ gnutls_free_function gt_free_func);
/* For use in callbacks */
extern gnutls_alloc_function gnutls_malloc;
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);
diff --git a/lib/gnutls_session_pack.c b/lib/gnutls_session_pack.c
index ecf24188d7..5fc48fefb7 100644
--- a/lib/gnutls_session_pack.c
+++ b/lib/gnutls_session_pack.c
@@ -269,6 +269,8 @@ pack_certificate_auth_info (gnutls_session_t session,
if (info)
{
+ cert_size = 0;
+
for (i = 0; i < info->ncerts; i++)
cert_size += info->raw_certificate_list[i].size;