Skip to content

urlapi: IPv6 zone id that starts with "25" loses those two characters #23658

Closed

Description

@urazoff

I did this

$ curl --version
curl 8.23.0 ...
$ curl -g -s -o /dev/null --connect-timeout 1 -w 'zoneid=%{url.zoneid}\n' "http://[fe80::1%25251]/"
zoneid=1

The same command with curl 8.7.1 prints zoneid=251. Likewise %2525eth gives eth instead of 25eth, and master 25f035e behaves like 8.23.0.

The host is URL-decoded before ipv6_parse() sees it, so %25251 is already %251 there, and then ipv6_parse() skips a "25" after the % again:

/* pass '25' if present and is a URL encoded percent sign */
if(!strncmp(h, "25", 2) && h[2] && (h[2] != ']'))
  h += 2;

Reported by Dilshod Urazov (GenProof)

I expected the following

Zone id 251 (and 25eth).

curl/libcurl version

curl 8.23.0 and master 25f035e

operating system

24.6.0 Darwin Kernel Version 24.6.0: Wed Nov 5 21:34:00 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T8132 arm64

Activity

  1. dfandrich commented on Oct 28, 2026

    @dfandrich
    Contributor
  2. urazoff commented on Oct 28, 2026

    @urazoff
    Author
    1. %25 is how you escape a % in a URL. If you want to use a zone ID of 25251 (or
      %any other zone ID), you first need to escape the percent, leading to a URL of:
      http://[fe80::1%2525251]/

    Right, and that's what my URL does: %25 followed by the zone id 251. Your example shows the same problem:

    $ curl --version | head -1
    curl 8.7.1 ...
    $ curl -g -s -o /dev/null -w 'zoneid=%{url.zoneid}\n' "http://[fe80::1%2525251]/"
    zoneid=25251
    
    $ curl --version | head -1
    curl 8.23.0 ...
    $ curl -g -s -o /dev/null -w 'zoneid=%{url.zoneid}\n' "http://[fe80::1%2525251]/"
    zoneid=251
    
  3. dfandrich commented on Oct 28, 2026

    @dfandrich
    Contributor
  4. self-assigned this
    on Oct 28, 2026
  5. added a commit that references this issue on Oct 29, 2026
    a7023ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions