diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-05-27 21:11:41 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-05-27 21:11:41 +0000 |
commit | f1515ac8dfd090f06c2708a17141deec0b7fb6b3 (patch) | |
tree | 17e0021d8de47941c0236448203ece1cfcf214f8 /lib/gnutls_v2_compat.c | |
parent | 74ce01c7dc293a1cf3a81d59bcd2b42faae7b751 (diff) | |
download | gnutls-f1515ac8dfd090f06c2708a17141deec0b7fb6b3.tar.gz |
added some extra checks in hello packet parsing.
Diffstat (limited to 'lib/gnutls_v2_compat.c')
-rw-r--r-- | lib/gnutls_v2_compat.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gnutls_v2_compat.c b/lib/gnutls_v2_compat.c index 25190d3441..7e603ff87d 100644 --- a/lib/gnutls_v2_compat.c +++ b/lib/gnutls_v2_compat.c @@ -46,6 +46,8 @@ static int _gnutls_handshake_select_v2_suite(gnutls_session session, opaque *dat int i, j, ret; opaque* _data; int _datalen; + + _gnutls_handshake_log( "HSK[%x]: Parsing a version 2.0 client hello.\n", session); _data = gnutls_malloc( datalen); if (_data==NULL) { @@ -53,7 +55,10 @@ static int _gnutls_handshake_select_v2_suite(gnutls_session session, opaque *dat return GNUTLS_E_MEMORY_ERROR; } - _gnutls_handshake_log( "HSK[%x]: Parsing a version 2.0 client hello.\n", session); + if (datalen % 3 != 0) { + gnutls_assert(); + return GNUTLS_E_UNEXPECTED_PACKET_LENGTH; + } i = _datalen = 0; for (j = 0; j < datalen; j += 3) { @@ -182,7 +187,7 @@ int _gnutls_read_client_hello_v2(gnutls_session session, opaque * data, /* read random new values -skip session id for now */ DECR_LEN(len, session_id_len); /* skip session id for now */ memcpy( session_id, &data[pos], session_id_len); - pos+=session_id_len; + pos += session_id_len; DECR_LEN(len, challenge); memset( random, 0, TLS_RANDOM_SIZE); |