aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2014-09-09 18:32:43 +0200
committerAnders Svensson <[email protected]>2014-09-09 18:32:43 +0200
commitde0c4b164fce97b2bed420a714537e7b1662f073 (patch)
tree60f2fb9bc4732ed3be2231f98602970edc09767d /lib/diameter
parent681f390324315266e9480b3471c1c4aeda004b5d (diff)
parentf1c76cec3d025df75bf76c0c5f596a5b00e24e41 (diff)
downloadotp-de0c4b164fce97b2bed420a714537e7b1662f073.tar.gz
otp-de0c4b164fce97b2bed420a714537e7b1662f073.tar.bz2
otp-de0c4b164fce97b2bed420a714537e7b1662f073.zip
Merge branch 'anders/diameter/5014/OTP-12074' into maint
* anders/diameter/5014/OTP-12074: Don't leave extra bit in decoded AVP data
Diffstat (limited to 'lib/diameter')
-rw-r--r--lib/diameter/include/diameter_gen.hrl17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/diameter/include/diameter_gen.hrl b/lib/diameter/include/diameter_gen.hrl
index 233eb8dd15..bc25f7d472 100644
--- a/lib/diameter/include/diameter_gen.hrl
+++ b/lib/diameter/include/diameter_gen.hrl
@@ -320,12 +320,27 @@ d(Name, Avp, Acc) ->
{[H | Avps], pack_avp(Name, A, T)}
catch
error: Reason ->
- d(undefined == Failed orelse is_failed(), Reason, Name, Avp, Acc)
+ d(undefined == Failed orelse is_failed(),
+ Reason,
+ Name,
+ trim(Avp),
+ Acc)
after
reset(?STRICT_KEY, Strict),
reset(?FAILED_KEY, Failed)
end.
+%% trim/1
+%%
+%% Remove any extra bit that was added in diameter_codec to induce a
+%% 5014 error.
+
+trim(#diameter_avp{data = <<0:1, Bin/binary>>} = Avp) ->
+ Avp#diameter_avp{data = Bin};
+
+trim(Avp) ->
+ Avp.
+
%% dict/1
%%
%% Retrieve the dictionary for the best-effort decode of Failed-AVP,