aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1rtt_ber.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-02-28 15:09:06 +0100
committerBjörn Gustavsson <[email protected]>2013-05-31 14:52:17 +0200
commit95af544936f9b6d7b8d03f3f49effaf5c314513d (patch)
treee77cf30cb449c76c4587dcc5e41697a7c3835add /lib/asn1/src/asn1rtt_ber.erl
parent902b51b8b43fe66fd4488c7fa10c05c3b9da59b4 (diff)
downloadotp-95af544936f9b6d7b8d03f3f49effaf5c314513d.tar.gz
otp-95af544936f9b6d7b8d03f3f49effaf5c314513d.tar.bz2
otp-95af544936f9b6d7b8d03f3f49effaf5c314513d.zip
Correct encoding (decoding) of lengths less than the root range
Given the type: S ::= IA5String (SIZE (5, ...)) attempting to encode (to PER/UPER) a string shorter than 5 characters would fail. Similarly, attempting to decode such string in the BER format would fail. In the case of BER, we can do no range checks if the size constraint is extensible.
Diffstat (limited to 'lib/asn1/src/asn1rtt_ber.erl')
-rw-r--r--lib/asn1/src/asn1rtt_ber.erl7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/asn1/src/asn1rtt_ber.erl b/lib/asn1/src/asn1rtt_ber.erl
index 5fbf116747..34f246fb22 100644
--- a/lib/asn1/src/asn1rtt_ber.erl
+++ b/lib/asn1/src/asn1rtt_ber.erl
@@ -1270,12 +1270,7 @@ check_restricted_string(Val, StrLen, Range) ->
case Range of
{Lb,Ub} when StrLen >= Lb, Ub >= StrLen -> % variable length constraint
Val;
- {{Lb,_Ub},[]} when StrLen >= Lb ->
- Val;
- {{Lb,_Ub},_Ext=[Min|_]} when StrLen >= Lb; StrLen >= Min ->
- Val;
- {{Lb1,Ub1},{Lb2,Ub2}} when StrLen >= Lb1, StrLen =< Ub1;
- StrLen =< Ub2, StrLen >= Lb2 ->
+ {_,Ext} when is_list(Ext) ->
Val;
StrLen -> % fixed length constraint
Val;