Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool_getparam: Support size modifiers for --max-filesize #2179

Closed
wants to merge 1 commit into from

Conversation

jay
Copy link
Member

@jay jay commented Dec 17, 2017

  • Move the size modifier detection code from limit-rate to its own
    function so that it can also be used with max-filesize.

Size modifiers are the suffixes such as G (gigabyte), M (megabyte) etc.

For example --max-filesize 1G

Ref: https://curl.haxx.se/mail/archive-2017-12/0000.html

Closes #xxxx


As proposed by @gvanem on the curl tool mailing list. I modified it slightly for error, doc and checksrc compliance.

- Move the size modifier detection code from limit-rate to its own
  function so that it can also be used with max-filesize.

Size modifiers are the suffixes such as G (gigabyte), M (megabyte) etc.

For example --max-filesize 1G

Ref: https://curl.haxx.se/mail/archive-2017-12/0000.html

Closes #xxxx
switch(*unit) {
case 'G':
case 'g':
value *= 1024*1024*1024;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while fixing this, we should probably also fix the code to avoid the risk for integer overflows in these multiplications and instead return an error if that large values are used!

@jay jay closed this in 859ac36 Dec 26, 2017
@jay jay deleted the add_size_modifier_for_max-filesize branch December 26, 2017 07:17
@lock lock bot locked as resolved and limited conversation to collaborators May 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

2 participants