File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
pg/src/main/java/org/bouncycastle/bcpg Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,21 @@ public class UserAttributeSubpacketInputStream
13
13
extends InputStream
14
14
implements UserAttributeSubpacketTags
15
15
{
16
- public static int MAX_LEN = 1 << 30 ;
17
-
18
16
InputStream in ;
17
+ private final int limit ;
19
18
20
19
public UserAttributeSubpacketInputStream (
21
20
InputStream in )
22
21
{
22
+ this (in , StreamUtil .findLimit (in ));
23
+ }
24
+
25
+ public UserAttributeSubpacketInputStream (
26
+ InputStream in ,
27
+ int limit
28
+ ) {
23
29
this .in = in ;
30
+ this .limit = limit ;
24
31
}
25
32
26
33
public int available ()
@@ -77,9 +84,9 @@ public UserAttributeSubpacket readPacket()
77
84
if (bodyLen < 1 ) {
78
85
throw new MalformedPacketException ("Body length octet too small." );
79
86
}
80
- if (bodyLen > MAX_LEN )
87
+ if (bodyLen > limit )
81
88
{
82
- throw new MalformedPacketException ("Body length octet (" + bodyLen + ") exceeds limitations (" + MAX_LEN + ")." );
89
+ throw new MalformedPacketException ("Body length octet (" + bodyLen + ") exceeds limitations (" + limit + ")." );
83
90
}
84
91
if (flags [StreamUtil .flag_eof ])
85
92
{
You can’t perform that action at this time.
0 commit comments