Fix range parsing regression introduced in #147
diff --git a/CHANGES.md b/CHANGES.md
index b134182..b591a43 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,8 @@
+Version 2.11.2 released 2015-01-16
+
+* Fix regression introduced in #147
+  https://github.com/mochi/mochiweb/pull/147
+
 Version 2.11.1 released 2015-01-16
 
 * Accept range end position which exceededs the resource size
diff --git a/src/mochiweb.app.src b/src/mochiweb.app.src
index bb4f4af..97fc90d 100644
--- a/src/mochiweb.app.src
+++ b/src/mochiweb.app.src
@@ -1,7 +1,7 @@
 %% This is generated from src/mochiweb.app.src
 {application, mochiweb,
  [{description, "MochiMedia Web Server"},
-  {vsn, "2.11.1"},
+  {vsn, "2.11.2"},
   {modules, []},
   {registered, []},
   {env, []},
diff --git a/src/mochiweb_http.erl b/src/mochiweb_http.erl
index 271531b..1ea1f15 100644
--- a/src/mochiweb_http.erl
+++ b/src/mochiweb_http.erl
@@ -184,11 +184,9 @@
             {R, Size - R};
         {_OutOfRange, none} ->
             invalid_range;
-        {Start, End} when 0 =< Start, Start < Size, Start =< End ->
-            {Start, End - Start + 1};
-        {Start, End} when 0 =< Start, Start =< End, End >= Size ->
-            {Start, Size - Start};
-        {_OutOfRange, _End} ->
+        {Start, End} when Start >= 0, Start < Size, Start =< End ->
+            {Start, erlang:min(End + 1, Size) - Start};
+        {_InvalidStart, _InvalidEnd} ->
             invalid_range
     end.