mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
XEP-0198: Cope with invalid 'from'/'to' attributes
Check whether the 'from' and 'to' attributes are valid before bouncing or resending a stanza from the stream management queue. They might be invalid in certain corner cases. Thanks to Evgeniy for spotting this.
This commit is contained in:
parent
0ae84a646f
commit
e54ba3db5b
@ -2998,10 +2998,13 @@ handle_unacked_stanzas(#state{mgmt_state = MgmtState} = StateData, F)
|
||||
lists:foreach(
|
||||
fun({_, Time, #xmlel{attrs = Attrs} = El}) ->
|
||||
From_s = fxml:get_attr_s(<<"from">>, Attrs),
|
||||
From = jid:from_string(From_s),
|
||||
To_s = fxml:get_attr_s(<<"to">>, Attrs),
|
||||
To = jid:from_string(To_s),
|
||||
F(From, To, El, Time)
|
||||
case {jid:from_string(From_s), jid:from_string(To_s)} of
|
||||
{#jid{} = From, #jid{} = To} ->
|
||||
F(From, To, El, Time);
|
||||
{_, _} ->
|
||||
?DEBUG("Dropping stanza due to invalid JID(s)", [])
|
||||
end
|
||||
end, queue:to_list(Queue))
|
||||
end;
|
||||
handle_unacked_stanzas(_StateData, _F) ->
|
||||
|
Loading…
Reference in New Issue
Block a user