summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-09-04 16:57:43 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-09-04 16:57:43 +0000
commitffb62d2cd5146f62b76294c87b7643dd60459ba8 (patch)
tree10256d07246728a937a7528ba397eaffbef9d2f5
parenta1710115521023f692390e58bd0e872cf19d632a (diff)
downloadgnutls-ffb62d2cd5146f62b76294c87b7643dd60459ba8.tar.gz
Corrected extension type checks which used an 8 bit extension size, instead of 16 bits.
-rw-r--r--NEWS2
-rw-r--r--lib/gnutls_extensions.c8
-rw-r--r--lib/gnutls_int.h8
3 files changed, 10 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index eeb0efe10f..896101083f 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ Version 0.5.6
- Corrected bugs in SRP implementation, which prevented gnutls
to interoperate with other implementations.
- Corrected bug in cert_type extension.
+- Corrected extension type checks which used an 8 bit extension size,
+ instead of 16 bits.
Version 0.5.5 (3/09/2002)
- Updated the SRP implementation to the latest draft. The blowfish
diff --git a/lib/gnutls_extensions.c b/lib/gnutls_extensions.c
index a05902fb47..68fe3844d3 100644
--- a/lib/gnutls_extensions.c
+++ b/lib/gnutls_extensions.c
@@ -83,7 +83,7 @@ const char *_gnutls_extension_get_name(uint16 type)
/* Checks if the extension we just received is one of the
* requested ones. Otherwise it's a fatal error.
*/
-static int _gnutls_extension_list_check( gnutls_session session, uint8 type) {
+static int _gnutls_extension_list_check( gnutls_session session, uint16 type) {
int i;
if (session->security_parameters.entity==GNUTLS_CLIENT) {
for(i=0;i<session->internals.extensions_sent_size;i++) {
@@ -154,12 +154,10 @@ int i;
* This list is used to check whether the (later) received
* extensions are the ones we requested.
*/
-static void _gnutls_extension_list_add( gnutls_session session, uint8 type) {
+static void _gnutls_extension_list_add( gnutls_session session, uint16 type) {
if (session->security_parameters.entity==GNUTLS_CLIENT) {
- if (session->internals.extensions_sent_size <
- sizeof(session->internals.extensions_sent)) {
-
+ if (session->internals.extensions_sent_size < MAX_EXT_TYPES) {
session->internals.extensions_sent[session->internals.extensions_sent_size] = type;
session->internals.extensions_sent_size++;
} else {
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 437aa11490..502df46361 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -65,6 +65,8 @@ typedef int gnutls_transport_ptr;
#define MAX_LOG_SIZE 1024 /* maximum number of log message */
#define MAX_SRP_USERNAME 256
+/* we can receive up to MAX_EXT_TYPES extensions.
+ */
#define MAX_EXT_TYPES 16
/* The initial size of the receive
@@ -525,9 +527,9 @@ typedef struct {
/* holds the extensions we sent to the peer
* (in case of a client)
*/
- uint8 extensions_sent[MAX_EXT_TYPES];
- uint8 extensions_sent_size;
-
+ uint16 extensions_sent[MAX_EXT_TYPES];
+ uint16 extensions_sent_size;
+
/* is 0 if we are to send the whole PGP key, or non zero
* if the fingerprint is to be sent.
*/