diff --git a/src/main/java/org/mariadb/jdbc/internal/util/Utils.java b/src/main/java/org/mariadb/jdbc/internal/util/Utils.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/mariadb/jdbc/internal/util/Utils.java
+++ b/src/main/java/org/mariadb/jdbc/internal/util/Utils.java
@@ -665,7 +665,7 @@ public class Utils {
         int pos = offset;
         int posHexa = 0;
 
-        while (pos < dataLength) {
+        while (pos < dataLength + offset) {
             int byteValue = bytes[pos] & 0xFF;
             outputBuilder.append(hexArray[byteValue >>> 4])
                     .append(hexArray[byteValue & 0x0F])
[misc] correcting debug output when having offset