Closed qwer02224 closed 3 years ago
In the SMPP specification, the max size for COctetsString is in octets (16 for system_id). This is including the null byte (octet), termanating the string. So for system_id, there are maximum 15 bytes (octets) of data , followed by the 0x00 byte. Like how the C language stores strings in memory. The isCOctetStringValid validates it correctly, as a string of 16 bytes does not leave room to add the 0x00 byte.
static boolean isCOctetStringValid(String value, int maxLength) { if (value == null) { return true; } if (value.length() >= maxLength) { return false; } return true; }
For example, system_ The MaxLength of ID is 16, which is verified by this method. If the value length is exactly 16, the verification will fail