Summary
parseRange in internal/news/nntpd/server.go rejects the open-ended range form low- (e.g. OVER 5-) as malformed and returns an empty (0, 0) range. As a result, OVER/XOVER with a trailing-dash range return no articles instead of every article numbered >= low.
RFC background
RFC 3977 defines a range as one of three forms:
number — a single article
number- — that article through the highest article in the group (open-ended)
number-number — a closed range
The open-ended number- form is very common in real NNTP clients (e.g. "give me everything from where I left off"). INN, Cyrus, and other servers all support it.
Where the bug is
parts := strings.Split(spec, "-")
...
h, err := strconv.ParseInt(parts[1], 10, 64) // parts[1] == "" for "5-"
if err != nil {
return 0, 0 // malformed — empty range
}
For spec = "5-", strings.Split yields ["5", ""]. ParseInt("") errors, so the function returns (0, 0) and handleOver then asks the backend for an empty range — returning zero overview lines.
This looks like an over-correction of the earlier "reject malformed OVER ranges" fix (#45/#46): malformed ranges are now correctly rejected, but the valid open-ended form got swept up with them.
Reproduction
- Select a group that has articles (e.g. numbers 1..20).
- Send
XOVER 5-.
- Observe: server returns the
224 line then an empty body.
- Expected: overview lines for articles 5 through 20.
Fix
Treat an empty upper bound as unbounded (math.MaxInt64), and reject specs with more than one dash (e.g. 1-2-3). I've opened a PR with the fix and tests.
Summary
parseRangeininternal/news/nntpd/server.gorejects the open-ended range formlow-(e.g.OVER 5-) as malformed and returns an empty(0, 0)range. As a result,OVER/XOVERwith a trailing-dash range return no articles instead of every article numbered>= low.RFC background
RFC 3977 defines a
rangeas one of three forms:number— a single articlenumber-— that article through the highest article in the group (open-ended)number-number— a closed rangeThe open-ended
number-form is very common in real NNTP clients (e.g. "give me everything from where I left off"). INN, Cyrus, and other servers all support it.Where the bug is
For
spec = "5-",strings.Splityields["5", ""].ParseInt("")errors, so the function returns(0, 0)andhandleOverthen asks the backend for an empty range — returning zero overview lines.This looks like an over-correction of the earlier "reject malformed OVER ranges" fix (#45/#46): malformed ranges are now correctly rejected, but the valid open-ended form got swept up with them.
Reproduction
XOVER 5-.224line then an empty body.Fix
Treat an empty upper bound as unbounded (
math.MaxInt64), and reject specs with more than one dash (e.g.1-2-3). I've opened a PR with the fix and tests.