aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/misc
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-08-14 16:16:49 +0200
committerMicael Karlberg <[email protected]>2012-08-14 16:16:49 +0200
commit20be9649a6c11ab01f44fb375a50de43f8142b45 (patch)
treea231387d16fd660525bdc1d0e01ddb6702d8d294 /lib/snmp/src/misc
parent8b70cc1a933b6d05ce91679b77fc3a496ad41266 (diff)
parent3cdb7781aca3cfff24485f7a9dbe704a4824d5e1 (diff)
downloadotp-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
Diffstat (limited to 'lib/snmp/src/misc')
-rw-r--r--lib/snmp/src/misc/snmp_pdus.erl28
1 files changed, 18 insertions, 10 deletions
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]) ->