iperf icon indicating copy to clipboard operation
iperf copied to clipboard

Initialize cookie buffer

Open MattCatz opened this issue 9 months ago • 0 comments

  • Version of iperf3 (or development branch, such as master or 3.1-STABLE) to which this pull request applies: 3.16

  • Issues fixed (if any): uninitialized buffer

  • Brief description of code changes (suitable for use as a commit message):

Nread reads up to N bytes from the socket. Since we only check that we read more than 0 bytes, it's possible for the cookie buffer only be partially initialized (and may not contain a valid null terminated string). Initializing the buffer to 0 fixes this.

Also swap strcmp with strncmp since we know know exactly how long a cookie should be. This will help prevent any buffer overflows if the length of the cookie ever changes for some reason.

MattCatz avatar May 10 '24 21:05 MattCatz