Skip to content

Commit

Permalink
Fix issue 1662 - not allow negative test duration (with rebase and ch…
Browse files Browse the repository at this point in the history
…anges per reviewer comments)
  • Loading branch information
davidBar-On authored and bmah888 committed Mar 25, 2024
1 parent 46f6050 commit b5eb3a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
break;
case 't':
test->duration = atoi(optarg);
if (test->duration > MAX_TIME) {
if (test->duration > MAX_TIME || test->duration < 0) {
i_errno = IEDURATION;
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/iperf_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ iperf_strerror(int int_errno)
snprintf(errstr, len, "some option you are trying to set is client only");
break;
case IEDURATION:
snprintf(errstr, len, "test duration too long (maximum = %d seconds)", MAX_TIME);
snprintf(errstr, len, "test duration valid values are 0 to %d seconds", MAX_TIME);
break;
case IENUMSTREAMS:
snprintf(errstr, len, "number of parallel streams too large (maximum = %d)", MAX_STREAMS);
Expand Down

0 comments on commit b5eb3a4

Please sign in to comment.