Skip to content

Commit

Permalink
Merge pull request #1698 from MattCatz/patch-1
Browse files Browse the repository at this point in the history
Initialize cookie buffer
  • Loading branch information
bmah888 authored May 24, 2024
2 parents 6254d11 + 356f01f commit 69a1eb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/iperf_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ iperf_tcp_accept(struct iperf_test * test)
{
int s;
signed char rbuf = ACCESS_DENIED;
char cookie[COOKIE_SIZE];
char cookie[COOKIE_SIZE] = {0};
socklen_t len;
struct sockaddr_storage addr;

Expand Down Expand Up @@ -149,7 +149,7 @@ iperf_tcp_accept(struct iperf_test * test)
return -1;
}

if (strcmp(test->cookie, cookie) != 0) {
if (strncmp(test->cookie, cookie, COOKIE_SIZE) != 0) {
if (Nwrite(s, (char*) &rbuf, sizeof(rbuf), Ptcp) < 0) {
iperf_err(test, "failed to send access denied from busy server to new connecting client, errno = %d\n", errno);
}
Expand Down

0 comments on commit 69a1eb3

Please sign in to comment.