Skip to content

Commit a461cfb

Browse files
Fix CA2022: Avoid inexact read with Stream.Read (#1080)
* Fix CA2022: Avoid inexact read with Stream.Read * Change fix to CA2022 (cherry picked from commit 57f0e43)
1 parent 6f2494b commit a461cfb

File tree

1 file changed

+3
-3
lines changed
  • dotnet/src/dotnetframework/GxClasses/Domain

1 file changed

+3
-3
lines changed

dotnet/src/dotnetframework/GxClasses/Domain/GxFtp.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,9 @@ private bool IsCompleteResponse(Stream responseStream)
847847
{
848848
int StatusCode=-1;
849849
Byte[] ByteArray = new Byte[responselength];
850-
String statuscodestr;
851-
responseStream.Read(ByteArray,0,responselength);
852-
statuscodestr=Encoding.ASCII.GetString(ByteArray,0,responselength);
850+
String statuscodestr;
851+
int bytesRead = responseStream.Read(ByteArray, 0, responselength);
852+
statuscodestr = Encoding.ASCII.GetString(ByteArray,0, bytesRead);
853853
if (responselength==5 && ByteArray[responselength-1] == '\n')
854854
{
855855

0 commit comments

Comments
 (0)