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:
parent
ee306250d7
commit
20585b9896
@ -2592,10 +2592,10 @@ iperf_new_stream(struct iperf_test *test, int s)
|
|||||||
|
|
||||||
char template[1024];
|
char template[1024];
|
||||||
if (test->template) {
|
if (test->template) {
|
||||||
snprintf(template, strlen(test->template), "%s", test->template);
|
snprintf(template, sizeof(template) / sizeof(char), "%s", test->template);
|
||||||
} else {
|
} else {
|
||||||
char buf[] = "/tmp/iperf3.XXXXXX";
|
char buf[] = "/tmp/iperf3.XXXXXX";
|
||||||
snprintf(template, strlen(buf), "%s", buf);
|
snprintf(template, sizeof(template) / sizeof(char), "%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
h_errno = 0;
|
h_errno = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user