Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cktan committed Nov 20, 2019
1 parent 8100f2e commit 8c31ea4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/c/s3pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static char* chat(int port, const char* request,
char* p = reply;
char* q = reply + replysz;
while (1) {

// always keep one extra byte slack for NUL term
if (p + 1 >= q) {
int newsz = replysz * 1.5;
Expand All @@ -160,10 +161,11 @@ static char* chat(int port, const char* request,
snprintf(errmsg, errmsgsz, "s3pool read: reply message too big -- out of memory");
goto bailout;
}
p = t + (p - reply);
q = t + newsz;
int n = p - reply;
reply = t;
replysz = newsz;
p = t + n;
q = reply + replysz;
}

assert(p + 1 < q);
Expand Down

0 comments on commit 8c31ea4

Please sign in to comment.