Repository: couchdb-couch Updated Branches: refs/heads/master 333bc1b0e -> 9383c5c46
Send 400 error if 'count' sent to _uuid is not an integer Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/9383c5c4 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/9383c5c4 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/9383c5c4 Branch: refs/heads/master Commit: 9383c5c460732a0b74a11b6a5efdab167bf1345c Parents: 333bc1b Author: Eric Avdey <e...@eiri.ca> Authored: Tue Feb 23 14:08:33 2016 -0400 Committer: Eric Avdey <e...@eiri.ca> Committed: Tue Feb 23 14:15:00 2016 -0400 ---------------------------------------------------------------------- src/couch_httpd_misc_handlers.erl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9383c5c4/src/couch_httpd_misc_handlers.erl ---------------------------------------------------------------------- diff --git a/src/couch_httpd_misc_handlers.erl b/src/couch_httpd_misc_handlers.erl index 10d6d9e..0cbbdd8 100644 --- a/src/couch_httpd_misc_handlers.erl +++ b/src/couch_httpd_misc_handlers.erl @@ -127,10 +127,13 @@ handle_restart_req(Req) -> handle_uuids_req(#httpd{method='GET'}=Req) -> Max = list_to_integer(config:get("uuids","max_count","1000")), - Count = list_to_integer(couch_httpd:qs_value(Req, "count", "1")), - case Count > Max of - true -> throw({forbidden, <<"count parameter too large">>}); - false -> ok + Count = try list_to_integer(couch_httpd:qs_value(Req, "count", "1")) of + N when N > Max -> + throw({forbidden, <<"count parameter too large">>}); + N -> N + catch + error:badarg -> + throw({bad_request, <<"count parameter is not an integer">>}) end, UUIDs = [couch_uuids:new() || _ <- lists:seq(1, Count)], Etag = couch_httpd:make_etag(UUIDs),