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
1313 extends InputStream
1414 implements UserAttributeSubpacketTags
1515{
16- public static int MAX_LEN = 1 << 30 ;
17-
1816 InputStream in ;
17+ private final int limit ;
1918
2019 public UserAttributeSubpacketInputStream (
2120 InputStream in )
2221 {
22+ this (in , StreamUtil .findLimit (in ));
23+ }
24+
25+ public UserAttributeSubpacketInputStream (
26+ InputStream in ,
27+ int limit
28+ ) {
2329 this .in = in ;
30+ this .limit = limit ;
2431 }
2532
2633 public int available ()
@@ -77,9 +84,9 @@ public UserAttributeSubpacket readPacket()
7784 if (bodyLen < 1 ) {
7885 throw new MalformedPacketException ("Body length octet too small." );
7986 }
80- if (bodyLen > MAX_LEN )
87+ if (bodyLen > limit )
8188 {
82- throw new MalformedPacketException ("Body length octet (" + bodyLen + ") exceeds limitations (" + MAX_LEN + ")." );
89+ throw new MalformedPacketException ("Body length octet (" + bodyLen + ") exceeds limitations (" + limit + ")." );
8390 }
8491 if (flags [StreamUtil .flag_eof ])
8592 {
You can’t perform that action at this time.
0 commit comments