• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

c-ares / c-ares / 28707169038
90%

Build:
DEFAULT BRANCH: main
Ran 04 Jul 2026 01:09PM UTC
Jobs 1
Files 177
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Jul 2026 01:06PM UTC coverage: 91.629% (+0.005%) from 91.624%
28707169038

push

github

web-flow
route numeric config parsing through range-checked ares_str_parse_uint (#1158)

Consolidates the atoi->strtoul sweep into one audited path, per review.
This is the single consolidated PR; #1157 and #1162 are closed in favor
of it.

- add `ares_str_parse_uint()`, a strtoul-based helper with
errno/end/range checks, and rework `ares_parse_port()` on top of it
- route link-local interface scope, sortlist netmask (was #1157), and
`name_match` (was #1162) through it
- fold the hand-rolled numeric-service port parser in
`ares_getaddrinfo.c` into `ares_parse_port()` so there's a single
validated path
- also validate the previously-unchecked `strtoul` in the resolv.conf
options parser (`ares_sysconfig_files.c`)

`atoi()` is undefined behavior on overflow, and the numeric tokens here
are only validated as digits (up to 15 for the zone id), so an
out-of-range value like `[fe80::1]:53%4294967297` was accepted instead
of rejected. The helper rejects overflow, trailing garbage, and anything
that doesn't fit the target width.

Behavior change worth noting: a numeric `getaddrinfo()` service that the
old hand-rolled parser tolerated now returns `ARES_ESERVICE`. This
covers an empty service `""` (previously yielded port 0), and leading
whitespace/sign like `" 80"` / `"+80"`. This matches musl; glibc treats
`""` like NULL and accepts the other two. POSIX-defensible either way.

Tests: direct `ares_str_parse_uint` unit test (`StrParseUint`) covering
the boundary/overflow/garbage cases, plus a `SetServersCSV` case
rejecting an out-of-range numeric scope.

Rebased on main to resolve the `ares_getaddrinfo.c` conflict with #1186.

---------

Signed-off-by: Syed Mohammed Nayyar <jmestwa@gmail.com>

46 of 49 new or added lines in 6 files covered. (93.88%)

4 existing lines in 4 files now uncovered.

23960 of 26149 relevant lines covered (91.63%)

12081.14 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
88.32
-0.54% src/lib/ares_sysconfig_files.c
1
65.61
1.87% src/lib/str/ares_str.c

Coverage Regressions

Lines Coverage ∆ File
1
88.32
-0.54% src/lib/ares_sysconfig_files.c
1
68.41
-0.11% src/lib/record/ares_dns_mapping.c
1
65.61
1.87% src/lib/str/ares_str.c
1
76.47
-1.53% src/lib/util/ares_math.c
Jobs
ID Job ID Ran Files Coverage
1 28707169038.1 04 Jul 2026 01:09PM UTC 940
61.45
GitHub Action Run
Source Files on build 28707169038
  • Tree
  • List 177
  • Changed 63
  • Source Changed 0
  • Coverage Changed 63
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • ff8bbff0 on github
  • Prev Build on main (#28688659819)
  • Next Build on main (#28707254443)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc