You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/06/03 07:11:14 UTC

[camel] 01/02: CAMEL-18127: fixed incorrect deserialization of String objects

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b03a0abe742750f51e123ffdba4440985b348a63
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Jun 2 16:17:28 2022 +0200

    CAMEL-18127: fixed incorrect deserialization of String objects
---
 .../src/main/java/org/apache/camel/resume/Deserializable.java        | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/resume/Deserializable.java b/core/camel-api/src/main/java/org/apache/camel/resume/Deserializable.java
index 32af4c8f126..a40a05ad180 100644
--- a/core/camel-api/src/main/java/org/apache/camel/resume/Deserializable.java
+++ b/core/camel-api/src/main/java/org/apache/camel/resume/Deserializable.java
@@ -34,8 +34,9 @@ public interface Deserializable {
                 return buffer.getLong();
             }
             case Serializable.TYPE_STRING: {
-                byte[] tmp = new byte[1024];
-                buffer.get(tmp, 0, 1024);
+                int remaining = buffer.remaining();
+                byte[] tmp = new byte[remaining];
+                buffer.get(tmp);
 
                 return new String(tmp);
             }