Skip to content

Commit

Permalink
Modify generate_one_byte_pkt()
Browse files Browse the repository at this point in the history
Modified generate_one_byte_pkt() to prefix the data with 1 byte.

This is the "equivalent" of what MySQL performs in
wrap_plguin_data_into_proper_command() , prefixing the data with
a command
  • Loading branch information
renecannao committed Jan 17, 2024
1 parent c3c9746 commit 29b7cd0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/MySQL_Protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,13 @@ void MySQL_Protocol::generate_one_byte_pkt(unsigned char b) {
sequence_id++;
mysql_hdr myhdr;
myhdr.pkt_id=sequence_id;
myhdr.pkt_length=1;
myhdr.pkt_length=2;
unsigned int size=myhdr.pkt_length+sizeof(mysql_hdr);
unsigned char *_ptr=(unsigned char *)l_alloc(size);
memcpy(_ptr, &myhdr, sizeof(mysql_hdr));
int l=sizeof(mysql_hdr);
_ptr[l]=1;
l++;
_ptr[l]=b;
(*myds)->PSarrayOUT->add((void *)_ptr,size);
(*myds)->pkt_sid=sequence_id;
Expand Down

0 comments on commit 29b7cd0

Please sign in to comment.