From d0b1cf88e38ff72ea7b5c54ff94b22f1bb8080d7 Mon Sep 17 00:00:00 2001 From: David Bar-On Date: Sun, 2 Jun 2024 12:48:08 +0300 Subject: [PATCH] Add check that size is positive --- src/iperf_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index c4d455cba..aa724e93d 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -2730,7 +2730,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) {