Skip to content

Commit fe144d1

Browse files
committed
Check return value
1 parent dfa92b8 commit fe144d1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pg/src/main/java/org/bouncycastle/gpg/SXprUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.bouncycastle.gpg;
22

3+
import java.io.EOFException;
34
import java.io.IOException;
45
import java.io.InputStream;
56

@@ -51,7 +52,10 @@ static byte[] readBytes(InputStream in, int ch)
5152

5253
byte[] data = new byte[len];
5354

54-
Streams.readFully(in, data);
55+
if (len != Streams.readFully(in, data))
56+
{
57+
throw new EOFException();
58+
}
5559

5660
return data;
5761
}
@@ -95,7 +99,7 @@ static void skipCloseParenthesis(InputStream in)
9599
int ch = in.read();
96100
if (ch != ')')
97101
{
98-
throw new IOException("unknown character encountered");
102+
throw new IOException("unknown character encountered: " + (char)ch);
99103
}
100104
}
101105
}

0 commit comments

Comments
 (0)