Skip to content

Commit

Permalink
Check for error packet while doing handshake
Browse files Browse the repository at this point in the history
If an error packet is received instead of the
expected handshake packet the function returns
DRIZZLE_RETURN_ERROR_CODE

Addresses #120
  • Loading branch information
andreas-bok-sociomantic authored and ben-palmer-sociomantic committed Mar 24, 2017
1 parent ded4898 commit 2352e6f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libdrizzle/handshake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ drizzle_return_t drizzle_state_handshake_server_read(drizzle_st *con)
return DRIZZLE_RETURN_OK;
}

if (con->packet_size < 46)
if (drizzle_check_unpack_error(con))
{
return DRIZZLE_RETURN_ERROR_CODE;
}
else if (con->packet_size < 46)
{
drizzle_set_error(con, __func__,
"bad packet size:>=46:%" PRIu32, con->packet_size);
Expand Down

0 comments on commit 2352e6f

Please sign in to comment.