iperf
iperf copied to clipboard
Initialize cookie buffer
-
Version of iperf3 (or development branch, such as
master
or3.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.