empty packets.
GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_TYPE_ANY_ERROR, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_SYNTAX_ERROR, 1),
GNUTLS_ERROR_ENTRY( GNUTLS_E_ASN1_DER_OVERFLOW, 1),
+ GNUTLS_ERROR_ENTRY( GNUTLS_E_TOO_MANY_EMPTY_PACKETS, 1),
{0}
};
#define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75
#define GNUTLS_E_ASN1_SYNTAX_ERROR -76
#define GNUTLS_E_ASN1_DER_OVERFLOW -77
+#define GNUTLS_E_TOO_MANY_EMPTY_PACKETS -78
#define GNUTLS_E_UNIMPLEMENTED_FEATURE -250
}
+#define MAX_EMPTY_PACKETS_SEQUENCE 4
+
/* This function behave exactly like read(). The only difference is
* that it accepts, the gnutls_state and the ContentType of data to
* send (if called by the user the Content is Userdata only)
uint8 *recv_data;
int ret, ret2;
uint16 header_size;
+ int empty_packet = 0;
begin:
+
+ if (empty_packet > MAX_EMPTY_PACKETS_SEQUENCE) {
+ gnutls_assert();
+ return GNUTLS_E_TOO_MANY_EMPTY_PACKETS;
+ }
+
/* default headers for TLS 1.0
*/
header_size = RECORD_HEADER_SIZE;
/* TLS 1.0 CBC protection. Read the next fragment.
*/
- if (ret==0) goto begin;
-
+ if (ret==0) {
+ empty_packet++;
+ goto begin;
+ }
+
return ret;
}