From 949b53faed849109787a9972149874f7dfe63029 Mon Sep 17 00:00:00 2001 From: mancha Date: Sun, 29 Sep 2013 Subject: CVE-2011-4128 [GNUTLS-SA-2011-2] gnutls_session_get_data: fix possible buffer overflow This is a backport adaptation for use with GnuTLS 2.8.6. Relevant upstream commits: -------------------------- https://gitorious.org/gnutls/gnutls/commit/190cef6eed37d0 https://gitorious.org/gnutls/gnutls/commit/e82ef4545e9e98 --- gnutls_session.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/lib/gnutls_session.c 2013-09-27 +++ b/lib/gnutls_session.c 2013-09-27 @@ -64,13 +64,14 @@ gnutls_session_get_data (gnutls_session_ gnutls_assert (); return ret; } - *session_data_size = psession.size; if (psession.size > *session_data_size) { + *session_data_size = psession.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);