diff options
author | Micael Karlberg <[email protected]> | 2012-08-14 16:16:49 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2012-08-14 16:16:49 +0200 |
commit | 20be9649a6c11ab01f44fb375a50de43f8142b45 (patch) | |
tree | a231387d16fd660525bdc1d0e01ddb6702d8d294 | |
parent | 8b70cc1a933b6d05ce91679b77fc3a496ad41266 (diff) | |
parent | 3cdb7781aca3cfff24485f7a9dbe704a4824d5e1 (diff) | |
download | otp-20be9649a6c11ab01f44fb375a50de43f8142b45.tar.gz otp-20be9649a6c11ab01f44fb375a50de43f8142b45.tar.bz2 otp-20be9649a6c11ab01f44fb375a50de43f8142b45.zip |
Merge branch 'bmk/snmp/bad_decode_TimeTicks/maint/OTP-10132' into bmk/snmp/snmp4221_integration2
Conflicts:
lib/snmp/doc/src/notes.xml
lib/snmp/src/app/snmp.appup.src
lib/snmp/src/misc/snmp_pdus.erl
-rw-r--r-- | lib/snmp/src/app/snmp.appup.src | 4 | ||||
-rw-r--r-- | lib/snmp/src/misc/snmp_pdus.erl | 28 |
2 files changed, 20 insertions, 12 deletions
diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index 573ba8d0f5..593ddd82bd 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -27,7 +27,7 @@ {load_module, snmpm, soft_purge, soft_purge, []}, {load_module, snmp_pdus, soft_purge, soft_purge, []}, {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []} + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []} ] }, {"4.21.7", @@ -317,7 +317,7 @@ {load_module, snmpm, soft_purge, soft_purge, []}, {load_module, snmp_pdus, soft_purge, soft_purge, []}, {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, - {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []} + {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []} ] }, {"4.21.7", diff --git a/lib/snmp/src/misc/snmp_pdus.erl b/lib/snmp/src/misc/snmp_pdus.erl index e15be4a298..5b8be90a71 100644 --- a/lib/snmp/src/misc/snmp_pdus.erl +++ b/lib/snmp/src/misc/snmp_pdus.erl @@ -298,22 +298,30 @@ dec_value([65 | Bytes]) -> %% Unsigned32 dec_value([66 | Bytes]) -> {Value, Rest} = dec_integer_notag(Bytes), - if - (Value >= 0) andalso (Value =< 16#ffffffff) -> - {{'Unsigned32', Value}, Rest}; - true -> - exit({error, {bad_unsigned32, Value}}) - end; + Value2 = + if + (Value >= 0) andalso (Value =< 16#ffffffff) -> + Value; + (Value < 0) -> + 16#ffffffff + Value + 1; + true -> + exit({error, {bad_unsigned32, Value}}) + end, + {{'Unsigned32', Value2}, Rest}; %% TimeTicks dec_value([67 | Bytes]) -> {Value, Rest} = dec_integer_notag(Bytes), - if - (Value >= 0) andalso (Value =< 16#ffffffff) -> - {{'TimeTicks', Value}, Rest}; + Value2 = + if + (Value >= 0) andalso (Value =< 16#ffffffff) -> + Value; + (Value < 0) -> + 16#ffffffff + Value + 1; true -> exit({error, {bad_timeticks, Value}}) - end; + end, + {{'TimeTicks', Value2}, Rest}; %% Opaque dec_value([68 | Bytes]) -> |