summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar default2024-08-24 14:36:19 +0200
committerGravatar default2024-08-24 14:36:19 +0200
commit60e907219b38caba051bccf8e99c9a30365e6d79 (patch)
treeb1ccca18960ff10d0dc765c6e41e2498cc2f9c31 /html.c
parentFixed typo. (diff)
downloadpenes-snac2-60e907219b38caba051bccf8e99c9a30365e6d79.tar.gz
penes-snac2-60e907219b38caba051bccf8e99c9a30365e6d79.tar.xz
penes-snac2-60e907219b38caba051bccf8e99c9a30365e6d79.zip
Archive and try to avoid crashing on unexpected 'content' field data type.
Diffstat (limited to 'html.c')
-rw-r--r--html.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/html.c b/html.c
index e2cc4b9..1eb4757 100644
--- a/html.c
+++ b/html.c
@@ -1692,7 +1692,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
1692 /** build the content string **/ 1692 /** build the content string **/
1693 const char *content = xs_dict_get(msg, "content"); 1693 const char *content = xs_dict_get(msg, "content");
1694 1694
1695 xs *c = sanitize(xs_is_null(content) ? "" : content); 1695 if (xs_type(content) != XSTYPE_STRING) {
1696 srv_archive_error("unexpected_content_xstype",
1697 "content field type", xs_stock(XSTYPE_DICT), msg);
1698
1699 content = "";
1700 }
1701
1702 xs *c = sanitize(content);
1696 1703
1697 /* do some tweaks to the content */ 1704 /* do some tweaks to the content */
1698 c = xs_replace_i(c, "\r", ""); 1705 c = xs_replace_i(c, "\r", "");