Commit 9cd74c3b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a missing boundary check for Range requests

Fixes #1323
Spotted & fix by:	gquintard
parent b253bf9c
...@@ -126,6 +126,8 @@ v1d_dorange(struct req *req, const char *r) ...@@ -126,6 +126,8 @@ v1d_dorange(struct req *req, const char *r)
} }
if (!has_low) { if (!has_low) {
low = req->obj->len - high; low = req->obj->len - high;
if (low < 0)
low = 0;
high = req->obj->len - 1; high = req->obj->len - 1;
} }
} else } else
......
...@@ -84,4 +84,9 @@ client c1 { ...@@ -84,4 +84,9 @@ client c1 {
rxresp rxresp
expect resp.status == 206 expect resp.status == 206
expect resp.bodylen == 100 expect resp.bodylen == 100
txreq -hdr "Range: bytes=-101"
rxresp
expect resp.status == 206
expect resp.bodylen == 100
} -run } -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment