Skip to content

Commit

Permalink
[#4051]fix buffer reader not correct when length is 0 (#4099)
Browse files Browse the repository at this point in the history
  • Loading branch information
liubao68 authored Dec 6, 2023
1 parent 3ccd557 commit 549024f
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ public int read(byte[] b) {
@Override
public int read(byte[] b, int off, int len) {
int avail = available();
if (len > avail) {
len = avail;
if (avail <= 0) {
return -1;
}

if (len == 0) {
return -1;
return 0;
}

if (len > avail) {
len = avail;
}

byteBuf.readBytes(b, off, len);
Expand Down

0 comments on commit 549024f

Please sign in to comment.