25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Malformed CAPTCHA response may crash a room. This is now fixed. (thanks to Evgeniy Khramtsov)

SVN Revision: 2150
This commit is contained in:
Badlop 2009-06-09 09:39:07 +00:00
parent a45e6da3d0
commit dd101c99e5

View File

@ -157,8 +157,9 @@ process_reply(El) ->
{error, malformed};
{true, Xdata} ->
Fields = jlib:parse_xdata_submit(Xdata),
[Id | _] = proplists:get_value("challenge", Fields, [none]),
[OCR | _] = proplists:get_value("ocr", Fields, [none]),
case {proplists:get_value("challenge", Fields),
proplists:get_value("ocr", Fields)} of
{[Id|_], [OCR|_]} ->
?T(case mnesia:read(captcha, Id, write) of
[#captcha{pid=Pid, args=Args, key=Key, tref=Tref}] ->
mnesia:delete({captcha, Id}),
@ -172,8 +173,13 @@ process_reply(El) ->
end;
_ ->
{error, not_found}
end)
end.
end);
_ ->
{error, malformed}
end
end;
process_reply(_) ->
{error, malformed}.
process(_Handlers, #request{method='GET', lang=Lang, path=[_, Id]}) ->