]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Corrected bug in heartbeat send (reported by Joke de Buhr).
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 2 Apr 2013 20:06:35 +0000 (22:06 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 2 Apr 2013 20:06:35 +0000 (22:06 +0200)
lib/ext/heartbeat.c

index 494b25fc5ca96f28bbcbf04297f83bd84331851b..eba24f89c90f20f15f667dd98aee4fd96c6d07b7 100644 (file)
@@ -94,12 +94,16 @@ heartbeat_send_data (gnutls_session_t session, const void *data,
   int ret, pos;
   uint8_t * response;
 
-  response = gnutls_malloc(1+data_size+DEFAULT_PAYLOAD_SIZE);
+  response = gnutls_malloc(1+2+data_size+DEFAULT_PAYLOAD_SIZE);
   if (response == NULL)
     return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
   
   pos = 0;
-  response[pos++] = 1;
+  response[pos++] = type;
+  
+  _gnutls_write_uint16(data_size, &response[pos]);
+  pos += 2;
+  
   memcpy(&response[pos], data, data_size);
   pos += data_size;