You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in decodeAvp() method of org.jdiameter.client.impl.parser.ElementParser class.
The bug is how the padding bytes are skipped (ElementParser.java lines 299-303):
if (length % 4 != 0) {
for (inti; length % 4 != 0; length += i) {
i = (int) in.skip((4 - length % 4));
}
}
If the bytes to skip are greater than the bytes available in the ByteArrayInputStream, the loop for above becomes infinite: in the first iteration in.skip() will return the skipped number of bytes (less than the requested) and in subsequent invocations in.skip() will return 0. So the loop never ends.
My proposed modification is:
if (length % 4 != 0) {
intpaddingBytes = 4 - length % 4;
if ((int) in.skip(paddingBytes) < paddingBytes) {
thrownewAvpDataException("Not enough data in buffer (padding bytes)!");
}
length += paddingBytes;
}
As the padding bytes are 1 to 3, this is a very uncommon situation, but it can happens when the wrong padded AVP is the last AVP in the diameter message.
The text was updated successfully, but these errors were encountered:
aliqued
added a commit
to aliqued/jdiameter
that referenced
this issue
Mar 14, 2018
There is a bug in
decodeAvp()
method oforg.jdiameter.client.impl.parser.ElementParser
class.The bug is how the padding bytes are skipped (ElementParser.java lines 299-303):
If the bytes to skip are greater than the bytes available in the ByteArrayInputStream, the loop
for
above becomes infinite: in the first iterationin.skip()
will return the skipped number of bytes (less than the requested) and in subsequent invocationsin.skip()
will return0
. So the loop never ends.My proposed modification is:
As the padding bytes are 1 to 3, this is a very uncommon situation, but it can happens when the wrong padded AVP is the last AVP in the diameter message.
The text was updated successfully, but these errors were encountered: