You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jm...@apache.org on 2018/01/10 05:34:31 UTC
[incubator-plc4x] branch master updated: chars not bytes and add
another check to stop running off end of buffer
This is an automated email from the ASF dual-hosted git repository.
jmclean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/master by this push:
new 3e19b41 chars not bytes and add another check to stop running off end of buffer
3e19b41 is described below
commit 3e19b41b62d4f5241ba1a2fafc7ae45a4b4e4962
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Wed Jan 10 16:34:22 2018 +1100
chars not bytes and add another check to stop running off end of buffer
---
.../src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
index c58f171..b364990 100644
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
@@ -400,8 +400,8 @@ public class Plc4XS7Protocol extends MessageToMessageCodec<S7Message, PlcRequest
i+=4;
} else if (datatype == String.class) {
StringBuilder builder = new StringBuilder();
- while (s7Data[i] != (byte) 0x0) {
- builder.append(s7Data[i]);
+ while (s7Data[i] != (byte) 0x0 && i < length) {
+ builder.append((char)s7Data[i]);
i++;
}
i++; // skip terminating character
--
To stop receiving notification emails like this one, please contact
['"commits@plc4x.apache.org" <co...@plc4x.apache.org>'].