Fix bug in iperf_new_stream leading to EINVAL

Fix invocation of snprintf in iperf_new_stream to prevent mkstemp from producing EINVAL.
This commit is contained in:
Tobias Nießen 2015-10-11 15:52:26 +02:00
parent ee306250d7
commit 20585b9896

View File

@ -2592,10 +2592,10 @@ iperf_new_stream(struct iperf_test *test, int s)
char template[1024];
if (test->template) {
snprintf(template, strlen(test->template), "%s", test->template);
snprintf(template, sizeof(template) / sizeof(char), "%s", test->template);
} else {
char buf[] = "/tmp/iperf3.XXXXXX";
snprintf(template, strlen(buf), "%s", buf);
snprintf(template, sizeof(template) / sizeof(char), "%s", buf);
}
h_errno = 0;