diff --git a/src/iperf_api.c b/src/iperf_api.c index 8a6635222..2d8d4ed42 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -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) {