Commit 91e0d689 authored by bjovke's avatar bjovke

Problem: Inconsistent size_t/int usage. Solution: types corrected.

parent 9c8844fd
...@@ -53,7 +53,7 @@ int zmq::mechanism_base_t::check_basic_command_structure (msg_t *msg_) ...@@ -53,7 +53,7 @@ int zmq::mechanism_base_t::check_basic_command_structure (msg_t *msg_)
} }
void zmq::mechanism_base_t::handle_error_reason (const char *error_reason, void zmq::mechanism_base_t::handle_error_reason (const char *error_reason,
int error_reason_len) size_t error_reason_len)
{ {
if (error_reason_len == 3 && error_reason[1] == '0' if (error_reason_len == 3 && error_reason[1] == '0'
&& error_reason[2] == '0' && error_reason[0] >= '3' && error_reason[2] == '0' && error_reason[0] >= '3'
......
...@@ -44,7 +44,7 @@ class mechanism_base_t : public mechanism_t ...@@ -44,7 +44,7 @@ class mechanism_base_t : public mechanism_t
int check_basic_command_structure (msg_t *msg_); int check_basic_command_structure (msg_t *msg_);
void handle_error_reason (const char *error_reason, int error_reason_len); void handle_error_reason (const char *error_reason, size_t error_reason_len);
}; };
} }
......
...@@ -112,7 +112,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_) ...@@ -112,7 +112,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_)
return -1; return -1;
const unsigned char *ptr = static_cast <unsigned char *> (msg_->data ()); const unsigned char *ptr = static_cast <unsigned char *> (msg_->data ());
int bytes_left = msg_->size (); size_t bytes_left = msg_->size ();
if (bytes_left < 6 || memcmp (ptr, "\x05HELLO", 6)) { if (bytes_left < 6 || memcmp (ptr, "\x05HELLO", 6)) {
session->get_socket ()->event_handshake_failed_protocol ( session->get_socket ()->event_handshake_failed_protocol (
...@@ -133,7 +133,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_) ...@@ -133,7 +133,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_)
const uint8_t username_length = *ptr++; const uint8_t username_length = *ptr++;
bytes_left -= 1; bytes_left -= 1;
if (bytes_left < (int)username_length) { if (bytes_left < username_length) {
// PLAIN I: invalid PLAIN client, sent malformed username // PLAIN I: invalid PLAIN client, sent malformed username
session->get_socket ()->event_handshake_failed_protocol ( session->get_socket ()->event_handshake_failed_protocol (
session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO); session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO);
...@@ -153,7 +153,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_) ...@@ -153,7 +153,7 @@ int zmq::plain_server_t::process_hello (msg_t *msg_)
const uint8_t password_length = *ptr++; const uint8_t password_length = *ptr++;
bytes_left -= 1; bytes_left -= 1;
if (bytes_left < (int)password_length) { if (bytes_left < password_length) {
// PLAIN I: invalid PLAIN client, sent malformed password // PLAIN I: invalid PLAIN client, sent malformed password
session->get_socket ()->event_handshake_failed_protocol ( session->get_socket ()->event_handshake_failed_protocol (
session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO); session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment