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

c-ares / c-ares / 24313282876 / 1
92%
main: 92%

Build:
DEFAULT BRANCH: main
Ran 12 Apr 2026 06:25PM UTC
Files 935
Run time 25s
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: 61.325% (+0.02%) from 61.308%
24313282876.1

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

24888 of 40584 relevant lines covered (61.32%)

7969.75 hits per line

Source Files on job 24313282876.1
  • Tree
  • List 935
  • Changed 58
  • Source Changed 0
  • Coverage Changed 58
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 24313282876
  • eaded4cb on github
  • Prev Job for on main (#24307852195.1)
  • Next Job for on main (#24313314138.1)
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