byte-range: fix range check for upper limit

the range check was done after the check lower > upper
so if it meets these conditions: lower <= upper and
lower > st.st_size then lower could still be > upper.
This commit is contained in:
Hiltjo Posthuma 2017-07-04 18:18:24 +02:00 committed by Laslo Hunhold
parent a092d9aa4b
commit 9b8e2bdeb6

View file

@ -667,10 +667,10 @@ sendresponse(int fd, struct request *r)
}
/* sanitize range */
upper = MIN(st.st_size, upper);
if (lower < 0 || upper < 0 || lower > upper) {
return sendstatus(fd, S_BAD_REQUEST);
}
upper = MIN(st.st_size, upper);
}
/* mime */