mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-29 20:59:47 +01:00
Problem: Inconsistent size_t/int usage. Solution: types corrected.
This commit is contained in:
@@ -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
|
|||||||
|
|
||||||
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_)
|
|||||||
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_)
|
|||||||
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_)
|
|||||||
|
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user