Skip to content

Commit 9de4928

Browse files
committed
NET-328 FromNetASCIIInputStream.read(byte[], int, int) may change length passed to superclass if not doing conversion
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/net/branches/NET_2_0@963161 13f79535-47bb-0310-9956-ffa450edef68
1 parent a213b44 commit 9de4928

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,14 @@ public int read(byte buffer[]) throws IOException
156156
@Override
157157
public int read(byte buffer[], int offset, int length) throws IOException
158158
{
159-
int ch, off;
159+
if (_noConversionRequired)
160+
return super.read(buffer, offset, length);
160161

161162
if (length < 1)
162163
return 0;
163164

165+
int ch, off;
166+
164167
ch = available();
165168

166169
__length = (length > ch ? ch : length);
@@ -169,8 +172,6 @@ public int read(byte buffer[], int offset, int length) throws IOException
169172
if (__length < 1)
170173
__length = 1;
171174

172-
if (_noConversionRequired)
173-
return super.read(buffer, offset, __length);
174175

175176
if ((ch = __read()) == -1)
176177
return -1;

0 commit comments

Comments
 (0)