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
base: master
from

Conversation

Projects
None yet
3 participants
@jay
Member

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.

tool_getparam: Support size modifiers for --max-filesize
- 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

@jay jay added the cmdline tool label Dec 17, 2017

switch(*unit) {
case 'G':
case 'g':
value *= 1024*1024*1024;

This comment has been minimized.

@bagder

bagder Dec 21, 2017

Member

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!

@bagder

bagder Dec 21, 2017

Member

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 jay:add_size_modifier_for_max-filesize branch Dec 26, 2017

@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.