summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/v1.erl5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/v1.erl b/src/v1.erl
index 304b0a8..c1db2c3 100644
--- a/src/v1.erl
+++ b/src/v1.erl
@@ -97,15 +97,14 @@
deliver(SessionID, R).
'get-entries'(SessionID, _Env, Input) ->
- %% TODO: Limit the number of returned entries (i.e. start-end) to
- %% something reasonable.
R = case lists:sort(httpd:parse_query(Input)) of
[{"end", EndInput}, {"start", StartInput}] ->
{Start, _} = string:to_integer(StartInput),
{End, _} = string:to_integer(EndInput),
case lists:member(error, [Start, End]) of
true -> html("get-entries: bad input:", [Start, End]);
- false -> catlfish:entries(Start, End)
+ false -> catlfish:entries(Start,
+ min(max(End, Start), Start + 999))
end;
_ -> html("get-entries: bad input:", Input)
end,