Skip to content

Commit

Permalink
misc: never decrement len to negative in recv_json
Browse files Browse the repository at this point in the history
  • Loading branch information
LBCrion committed Jun 22, 2024
1 parent de16168 commit e069864
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ json_object *recv_json ( gint sock, gssize len )
{
json = json_tokener_parse_ex(tok, buf, rlen);
if(len>0)
len-=rlen;
len-=MIN(rlen, MIN(len, bufsize));
}
json_tokener_free(tok);

Expand Down

0 comments on commit e069864

Please sign in to comment.