From 093f4af2827dab26785e788dc0d49d54308239b5 Mon Sep 17 00:00:00 2001 From: default Date: Fri, 8 Mar 2024 05:41:08 +0100 Subject: [PATCH] Shortened the maximum conversation levels. Set to a compilation define in MAX_CONVERSATION_LEVELS. --- activitypub.c | 2 +- html.c | 5 +++-- snac.h | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/activitypub.c b/activitypub.c index 162324e..f754ee0 100644 --- a/activitypub.c +++ b/activitypub.c @@ -310,7 +310,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level) { int status = 0; - if (level < 256 && !xs_is_null(*id)) { + if (level < MAX_CONVERSATION_LEVELS && !xs_is_null(*id)) { xs *msg = NULL; /* is the object already there? */ diff --git a/html.c b/html.c index 162a2da..d34439a 100644 --- a/html.c +++ b/html.c @@ -1334,8 +1334,9 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, } /* avoid too deep nesting, as it may be a loop */ - if (level >= 256) - return NULL; + if (level >= MAX_CONVERSATION_LEVELS) + return xs_html_tag("mark", + xs_html_text(L("Truncated (too deep)"))); if (strcmp(type, "Follow") == 0) { return xs_html_tag("div", diff --git a/snac.h b/snac.h index 05ea1e2..1afbfc7 100644 --- a/snac.h +++ b/snac.h @@ -16,6 +16,10 @@ #define MAX_THREADS 256 #endif +#ifndef MAX_CONVERSATION_LEVELS +#define MAX_CONVERSATION_LEVELS 48 +#endif + extern double disk_layout; extern xs_str *srv_basedir; extern xs_dict *srv_config;