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:
parent
a092d9aa4b
commit
9b8e2bdeb6
1 changed files with 1 additions and 1 deletions
2
quark.c
2
quark.c
|
@ -667,10 +667,10 @@ sendresponse(int fd, struct request *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sanitize range */
|
/* sanitize range */
|
||||||
|
upper = MIN(st.st_size, upper);
|
||||||
if (lower < 0 || upper < 0 || lower > upper) {
|
if (lower < 0 || upper < 0 || lower > upper) {
|
||||||
return sendstatus(fd, S_BAD_REQUEST);
|
return sendstatus(fd, S_BAD_REQUEST);
|
||||||
}
|
}
|
||||||
upper = MIN(st.st_size, upper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mime */
|
/* mime */
|
||||||
|
|
Loading…
Reference in a new issue