diff options
author | Anders Svensson <[email protected]> | 2014-09-08 20:15:36 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2014-09-08 20:15:36 +0200 |
commit | f1c76cec3d025df75bf76c0c5f596a5b00e24e41 (patch) | |
tree | 20523bc03567f5b08d8d421bf2db926ec85f621b | |
parent | 0f9cdbaf4d7fde93d319be7789dd4119092d91c6 (diff) | |
download | otp-f1c76cec3d025df75bf76c0c5f596a5b00e24e41.tar.gz otp-f1c76cec3d025df75bf76c0c5f596a5b00e24e41.tar.bz2 otp-f1c76cec3d025df75bf76c0c5f596a5b00e24e41.zip |
Don't leave extra bit in decoded AVP data
The bit is added in diameter_codec to induce a decode error in the case
of 5014 errors, but was not removed before returning the decoded result.
Code examining the binary data in a diameter_avp record would then see
the extra bit.
-rw-r--r-- | lib/diameter/include/diameter_gen.hrl | 17 |
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, |