commit 60e9072
default
·
2024-08-24 12:36:19 +0000 UTC
parent e648336
Archive and try to avoid crashing on unexpected 'content' field data type.
1 files changed,
+8,
-1
M
html.c
M
html.c
+8,
-1
1@@ -1692,7 +1692,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2 /** build the content string **/
3 const char *content = xs_dict_get(msg, "content");
4
5- xs *c = sanitize(xs_is_null(content) ? "" : content);
6+ if (xs_type(content) != XSTYPE_STRING) {
7+ srv_archive_error("unexpected_content_xstype",
8+ "content field type", xs_stock(XSTYPE_DICT), msg);
9+
10+ content = "";
11+ }
12+
13+ xs *c = sanitize(content);
14
15 /* do some tweaks to the content */
16 c = xs_replace_i(c, "\r", "");