aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2026-09-02 09:49:02 +0200
committergrunfink <grunfink@comam.es>2026-09-02 09:49:02 +0200
commit2085a9e91187e89a1eed83b1243521cd5038ca19 (patch)
treeb66b03dc9dc6d4f7210e0919f98c27fce0759b2a
parentdbff0032ecf575b9bfec9a0a3a9800dcdf4bd33d (diff)
Skip notification files that are too big.
-rw-r--r--data.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/data.c b/data.c
index 279f7af..2529713 100644
--- a/data.c
+++ b/data.c
@@ -3529,12 +3529,18 @@ xs_dict *notify_get(snac *snac, const char *id)
fn = xs_strip_i(fn);
fn = xs_str_cat(fn, ".json");
- FILE *f;
xs_dict *out = NULL;
- if ((f = fopen(fn, "r")) != NULL) {
- out = xs_json_load(f);
- fclose(f);
+ struct stat st;
+
+ if (stat(fn, &st) != -1) {
+ if (st.st_size < 100000) {
+ FILE *f;
+ if ((f = fopen(fn, "r")) != NULL) {
+ out = xs_json_load(f);
+ fclose(f);
+ }
+ }
}
return out;