aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-04-11 09:43:24 +0200
committerAnders Svensson <[email protected]>2013-04-22 13:17:46 +0200
commita732bb3496cf24e62b607293de7c5ae49b3891ce (patch)
treeb34656e4ef8ae511fc87e4ca3260b4caf03bcfbb /lib/diameter/src/base
parent7e9ae3007fd3c44a05a746628983faff401dfd0c (diff)
downloadotp-a732bb3496cf24e62b607293de7c5ae49b3891ce.tar.gz
otp-a732bb3496cf24e62b607293de7c5ae49b3891ce.tar.bz2
otp-a732bb3496cf24e62b607293de7c5ae49b3891ce.zip
Fix decode failure when AVP Length < 8
Such a length caused decode of a message with valid (24-bit) length to fail. Note that the error detected is wrong: it should be 5014 (INVALID_AVP_LENGTH), not 3009 (INVALID_AVP_BITS). This will be dealt with by OTP-11007.
Diffstat (limited to 'lib/diameter/src/base')
-rw-r--r--lib/diameter/src/base/diameter_codec.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl
index e446a0209c..09b99b2cae 100644
--- a/lib/diameter/src/base/diameter_codec.erl
+++ b/lib/diameter/src/base/diameter_codec.erl
@@ -427,6 +427,8 @@ split_avp(Bin) ->
<<Code:32, Flags:1/binary, Length:24, Rest/bitstring>>
= Bin,
+ 8 =< Length orelse ?THROW(invalid_avp_length),
+
DataSize = Length - 8, % size(Code+Flags+Length) = 8 octets
PadSize = (4 - (DataSize rem 4)) rem 4,