]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Added sanity checks for http-ranges
authorsb1066 <sb1066@gmail.com>
Fri, 9 Jul 2010 20:09:53 +0000 (20:09 +0000)
committersb1066 <sb1066@gmail.com>
Fri, 9 Jul 2010 20:09:53 +0000 (20:09 +0000)
src/webui/webui.c

index 6f90ac977d85cb51b2596a48ca366214b6ce43a4..e3394b280d1b504bb8e59ec264eb6a1c99bef2f6 100644 (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);