Added rare bug which would cause system crash

- Fixed Array Index out of Bounds when they try to send a message of 9 length and it is to be turned into a number
#story[782]
main
Fan-Wu Yang 9 years ago
parent 7dd07b470a
commit 278a7dbde0

@ -101,10 +101,10 @@ public class ByteConverter {
byte[] bites = new byte[maxSize];
if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
for (int i = 0; i < bytes.length; i++) {
bites[i] = bytes[i];
if (i > maxSize){//break if over hte limit
break;
}
bites[i] = bytes[i];
}
for (int i = bytes.length; i < maxSize; i++) {
bites[i] = 0b0;
@ -114,10 +114,10 @@ public class ByteConverter {
bites[i] = 0b0;
}
for (int i = maxSize - bytes.length; i < maxSize; i++) {
bites[i] = bytes[i - maxSize + bytes.length];
if (i > maxSize){//break if over the limit
break;
}
bites[i] = bytes[i - maxSize + bytes.length];
}
}
return bites;

Loading…
Cancel
Save