Accept --sleep <ms> in addition to --sleep=<ms>#359
Conversation
Issue rbsec#357: --sleep is the only common rate-limiting flag in sslscan and the manual arg parser only matched the strncmp("--sleep=", ...) form. The space-separated form --sleep <ms> silently fell through to the next else-if (and was eventually treated as an unrecognized argument or as a hostname), so users who tried --sleep 100 saw it appear to have no effect. Add a parallel branch that handles --sleep <ms>: it advances argLoop to consume the value, atoi-parses it, and sets options->sleep using the same >=0 guard as the existing branch. If the user passes --sleep with no following argument, print a friendly error pointing at both working forms and exit. End-to-end timing against example.com confirms both forms now sleep identically: --no-sleep: 0.26s --sleep=200: 2.49s (existing) --sleep 200: 2.51s (was broken; now fixed) Closes rbsec#357
|
I'm not against the idea of accepting both The error condition in this PR also don't work properly, because it only checks for But that command would never have been valid the first place, because options need to come before the hostname. So if you try and follow the recommendation and run |
Closes #357.
--sleepis the only common rate-limiting flag in sslscan and the manual arg parser only matched thestrncmp("--sleep=", ...)form. The space-separated form--sleep <ms>silently fell through to the next else-if (and was eventually treated as an unrecognized argument or as a hostname), so users who tried--sleep 100saw it appear to have no effect — that's exactly the confusion the issue describes.Fix
Add a parallel
else if (strcmp("--sleep", argv[argLoop]) == 0)branch that advancesargLoopto consume the value,atoi-parses it, and setsoptions->sleepusing the same>=0guard as the existing branch. If the user passes--sleepwith no following argument, print a friendly error pointing at both working forms:Verification
End-to-end timing against
example.comconfirms both forms now sleep identically:The build is clean against system OpenSSL on Linux:
I scoped this fix to
--sleeponly (the issue) rather than reworking the whole arg parser to handle both--option valueand--option=valuefor every flag — happy to extend the pattern if you'd prefer it consistent across all options.