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

c-ares / c-ares / 24313282876
92%

Build:
DEFAULT BRANCH: main
Ran 12 Apr 2026 06:25PM 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

12 Apr 2026 06:20PM UTC coverage: 91.71% (+0.008%) from 91.702%
24313282876

push

github

web-flow
validate RR counts before preallocation to reject malformed packets early (#1134)

## Summary

Validate DNS RR counts before preallocation to reject malformed packets
early.

## What’s the issue?

The parser currently trusts RR counts from the DNS header (`ANCOUNT`,
`NSCOUNT`, `ARCOUNT`) without verifying that the packet contains enough
data.

A malformed packet can claim a large number of records without providing
sufficient payload, causing the parser to proceed with unnecessary work
and incorrect handling.

## What changed?

- Added validation to ensure RR counts are feasible based on the
remaining buffer size
- Moved RR preallocation from `ares_dns_parse_header` to
`ares_dns_parse_buf`
- Perform validation after question parsing and before preallocation  
- Return `ARES_EBADRESP` early for malformed packets  

## Why this approach?

This keeps the parser aligned with its natural flow:

parse header → parse question → validate → preallocate → parse records

It avoids trusting unverified input and ensures malformed packets are
rejected early and consistently.

## Test

Added a regression test (`ParseMalformedRRCount`) that reproduces the
issue using a malformed packet with inconsistent RR count.

Signed-off-by: @jmestwa-coder

20 of 20 new or added lines in 2 files covered. (100.0%)

1 existing line in 1 file now uncovered.

22800 of 24861 relevant lines covered (91.71%)

13010.11 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
87.75
-0.1% src/lib/record/ares_dns_record.c
Jobs
ID Job ID Ran Files Coverage
1 24313282876.1 12 Apr 2026 06:24PM UTC 935
61.32
GitHub Action Run
Source Files on build 24313282876
  • Tree
  • List 177
  • Changed 58
  • Source Changed 0
  • Coverage Changed 58
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • eaded4cb on github
  • Prev Build on main (#24307852195)
  • Next Build on main (#24313314138)
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