Skip to content

Commit c248e53

Browse files
committed
MTU size check: improved
Do not use positional references to printf format string, which is a POSIX extension and not supported by Windows C library. + write the optarg string (in case that is only partionally parsed - atoi stopped at first non-number) refers to GH-437
1 parent e4248fe commit c248e53

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,12 @@ parse_options_internal(int argc, char *argv[], struct ug_options *opt)
814814
break;
815815
case 'm':
816816
opt->requested_mtu = atoi(optarg);
817-
if (opt->requested_mtu < 576 && optarg[strlen(optarg) - 1] != '!') {
818-
log_msg(LOG_LEVEL_WARNING, "MTU %1$u seems to be too low, use \"%1$u!\" to force.\n", opt->requested_mtu);
817+
if (opt->requested_mtu < 576 &&
818+
optarg[strlen(optarg) - 1] != '!') {
819+
log_msg(LOG_LEVEL_WARNING,
820+
"MTU %s seems to be too low, use "
821+
"\"%d!\" to force.\n",
822+
optarg, opt->requested_mtu);
819823
return -EXIT_FAIL_USAGE;
820824
}
821825
break;

0 commit comments

Comments
 (0)