aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-06-29 07:20:33 +0200
committerClombrong <cromblong@egregore.fun>2025-06-29 07:21:23 +0200
commita9a3defba5767e29aeb3d3585e9f5e4f957b14b6 (patch)
treea53a7ae208f2a5cfaab78b4e9d755d3c5f3c267f /lib
parent24fd5dc7ca43702a0222298c39b5d09ddcf93a8e (diff)
feat(stream): raise exception if there's bare text in <features>
Diffstat (limited to 'lib')
-rw-r--r--lib/stream.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/stream.ml b/lib/stream.ml
index 0b6763a..218cc37 100644
--- a/lib/stream.ml
+++ b/lib/stream.ml
@@ -14,6 +14,12 @@ let parse_features (el : Xml.element) : features =
let open Xml in
let open Either in
+ let children =
+ if not (List.for_all is_left el.children)
+ then raise (InvalidStanza (element_to_string el))
+ else List.filter_map find_left el.children
+ in
+
let parse_single_mechanism = function
| Left {local_name = "mechanism"; children = [Right mechanism]; _} ->
Sasl.parse_auth_mechanism mechanism