Skip to content

Commit

Permalink
Add check that size is positive
Browse files Browse the repository at this point in the history
  • Loading branch information
davidBar-On committed Sep 12, 2024
1 parent 0128d03 commit 5b0ed63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2801,7 +2801,7 @@ JSON_read(int fd)
*/
rc = Nread(fd, (char*) &nsize, sizeof(nsize), Ptcp);
hsize = ntohl(nsize);
if (rc == sizeof(nsize) && hsize <= MAX_PARAMS_JSON_STRING) {
if (rc == sizeof(nsize) && hsize > 0 && hsize <= MAX_PARAMS_JSON_STRING) {
/* Allocate a buffer to hold the JSON */
strsize = hsize + 1; /* +1 for trailing NULL */
if (strsize) {
Expand Down

0 comments on commit 5b0ed63

Please sign in to comment.