From 66c4e87ebf6de08ed9c3241a6dab60405ecad288 Mon Sep 17 00:00:00 2001 From: BmdOnline Date: Sun, 18 Apr 2021 23:35:41 +0200 Subject: [PATCH] Update read_int The offset is missing in the calculation. For example, the MySQL error code returned is false. --- src/MySQL_Packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MySQL_Packet.cpp b/src/MySQL_Packet.cpp index b9c0cf7..744bbee 100644 --- a/src/MySQL_Packet.cpp +++ b/src/MySQL_Packet.cpp @@ -470,7 +470,7 @@ int MySQL_Packet::read_int(int offset, int size) { new_size = size; int shifter = (new_size - 1) * 8; for (int i = new_size; i > 0; i--) { - value += (buffer[i-1] << shifter); + value += (buffer[offset+i-1] << shifter); shifter -= 8; } return value;