Accept --sleep <ms> in addition to --sleep=<ms>#359
Open
ChrisJr404 wants to merge 1 commit intorbsec:masterfrom
Open
Accept --sleep <ms> in addition to --sleep=<ms>#359ChrisJr404 wants to merge 1 commit intorbsec:masterfrom
ChrisJr404 wants to merge 1 commit intorbsec:masterfrom
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.