diff options
-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]) -> |