Added sanity checks for http-ranges

This commit is contained in:
sb1066 2010-07-09 20:09:53 +00:00
parent b71046db6a
commit 2c00a4da4f

View file

@ -241,6 +241,16 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque)
if(range != NULL)
sscanf(range, "bytes=%"PRId64"-%"PRId64"", &file_start, &file_end);
//Sanity checks
if(file_start < 0 || file_start >= st.st_size)
return 200;
if(file_end < 0 || file_end >= st.st_size)
return 200;
if(file_start > 0 || file_end)
return 200;
content_len = file_end - file_start+1;
sprintf(range_buf, "bytes %"PRId64"-%"PRId64"/%"PRId64"", file_start, file_end, st.st_size);