diff --git a/sql-common/net_serv.cc b/sql-common/net_serv.cc index 85639df00fd..72f6cbe5384 100644 --- a/sql-common/net_serv.cc +++ b/sql-common/net_serv.cc @@ -936,6 +936,9 @@ bool net_write_command(NET *net, uchar command, const uchar *header, static bool net_write_buff(NET *net, const uchar *packet, size_t len) { DBUG_TRACE; + if(len == 0) { + return false; + } ulong left_length; if (net->compress && net->max_packet > MAX_PACKET_LENGTH) left_length = (ulong)(MAX_PACKET_LENGTH - (net->write_pos - net->buff)); @@ -971,8 +974,10 @@ static bool net_write_buff(NET *net, const uchar *packet, size_t len) { if (len > net->max_packet) return net_write_packet(net, packet, len); /* Send out rest of the blocks as full sized blocks */ } - if (len > 0) memcpy(net->write_pos, packet, len); - net->write_pos += len; + if (len > 0) { + memcpy(net->write_pos, packet, len); + net->write_pos += len; + } return false; }