aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/tsi
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-01-30 02:11:35 +0100
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-01-30 02:11:35 +0100
commit213ed9185098c543996f2362ea4ee810930f6f5d (patch)
treeec393db8608bde3be050c31252d0e7a230567557 /src/core/tsi
parentc630682ad8c2cf597d1786ec637587678f3c7d6e (diff)
Re-enabling errors on warning, disabling unused parameter warning, and fixing all subsequent errors.
Diffstat (limited to 'src/core/tsi')
-rw-r--r--src/core/tsi/fake_transport_security.c3
-rw-r--r--src/core/tsi/ssl_transport_security.c7
2 files changed, 7 insertions, 3 deletions
diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c
index 0b245e4043..a96c7df4a3 100644
--- a/src/core/tsi/fake_transport_security.c
+++ b/src/core/tsi/fake_transport_security.c
@@ -38,6 +38,7 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
+#include <grpc/support/useful.h>
#include "src/core/tsi/transport_security.h"
/* --- Constants. ---*/
@@ -412,7 +413,7 @@ static tsi_result fake_handshaker_process_bytes_from_peer(
tsi_handshaker* self, const unsigned char* bytes, size_t* bytes_size) {
tsi_result result = TSI_OK;
tsi_fake_handshaker* impl = (tsi_fake_handshaker*)self;
- int expected_msg = impl->next_message_to_send - 1;
+ tsi_fake_handshake_message expected_msg = impl->next_message_to_send - 1;
tsi_fake_handshake_message received_msg;
if (!impl->needs_incoming_message || impl->result == TSI_OK) {
diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c
index 8801cc43df..0f8cbccb62 100644
--- a/src/core/tsi/ssl_transport_security.c
+++ b/src/core/tsi/ssl_transport_security.c
@@ -37,6 +37,7 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
+#include <grpc/support/useful.h>
#include "src/core/tsi/transport_security.h"
#include <openssl/bio.h>
@@ -565,7 +566,8 @@ static tsi_result build_alpn_protocol_name_list(
current += alpn_protocols_lengths[i];
}
/* Safety check. */
- if ((current - *protocol_name_list) != *protocol_name_list_length) {
+ if ((current < *protocol_name_list) ||
+ ((gpr_uintptr)(current - *protocol_name_list) != *protocol_name_list_length)) {
return TSI_INTERNAL_ERROR;
}
return TSI_OK;
@@ -1063,7 +1065,8 @@ static int server_handshaker_factory_alpn_callback(
while ((client_current - in) < inlen) {
unsigned char client_current_len = *(client_current++);
const unsigned char* server_current = factory->alpn_protocol_list;
- while ((server_current - factory->alpn_protocol_list) <
+ while ((server_current >= factory->alpn_protocol_list) &&
+ (gpr_uintptr)(server_current - factory->alpn_protocol_list) <
factory->alpn_protocol_list_length) {
unsigned char server_current_len = *(server_current++);
if ((client_current_len == server_current_len) &&