Skip to content

integer overflow in set_rate function #18624

@BobodevMm

Description

@BobodevMm

I did this

Setting the rate to huge number triggers an integer overflow in set_rate function.

curl --url "http:/127.0.0.1" --rate 5/12345678999999999s 

curl: too large --rate unit 
illegal hardware instruction  curl --url "http:/127.0.0.1" --rate 5/12345678999999999s 

I posted this here, cuz it it has no security impact (I believe) , just a normal bug ..

I expected the following

this will bypass the check (In set_rate() function)

    if((LONG_MAX / numerator) < numunits) {
      /* overflow, too large number */
      errorf("too large --rate unit");
      err = PARAM_NUMBER_TOO_LARGE;
    }

curl/libcurl version

curl 8.16.0 (x86_64-pc-linux-gnu) libcurl/8.16.0 OpenSSL/3.5.0 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 libpsl/0.21.2
Release-Date: 2025-09-10
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTPS-proxy IPv6 Largefile libz NTLM PSL SSL threadsafe TLS-SRP UnixSockets zstd

operating system

Debian 6.3.7-1kali1 (2023-06-29) x86_64

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions