Skip to content

Commit b5eb3a4

Browse files
davidBar-Onbmah888
authored andcommitted
Fix issue 1662 - not allow negative test duration (with rebase and changes per reviewer comments)
1 parent 46f6050 commit b5eb3a4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/iperf_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
13131313
break;
13141314
case 't':
13151315
test->duration = atoi(optarg);
1316-
if (test->duration > MAX_TIME) {
1316+
if (test->duration > MAX_TIME || test->duration < 0) {
13171317
i_errno = IEDURATION;
13181318
return -1;
13191319
}

src/iperf_error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ iperf_strerror(int int_errno)
166166
snprintf(errstr, len, "some option you are trying to set is client only");
167167
break;
168168
case IEDURATION:
169-
snprintf(errstr, len, "test duration too long (maximum = %d seconds)", MAX_TIME);
169+
snprintf(errstr, len, "test duration valid values are 0 to %d seconds", MAX_TIME);
170170
break;
171171
case IENUMSTREAMS:
172172
snprintf(errstr, len, "number of parallel streams too large (maximum = %d)", MAX_STREAMS);

0 commit comments

Comments
 (0)