commit 2085a9e
grunfink
·
2026-09-02 07:49:02 +0000 UTC
parent dbff003
Skip notification files that are too big.
1 files changed,
+10,
-4
M
data.c
M
data.c
+10,
-4
1@@ -3529,12 +3529,18 @@ xs_dict *notify_get(snac *snac, const char *id)
2 fn = xs_strip_i(fn);
3 fn = xs_str_cat(fn, ".json");
4
5- FILE *f;
6 xs_dict *out = NULL;
7
8- if ((f = fopen(fn, "r")) != NULL) {
9- out = xs_json_load(f);
10- fclose(f);
11+ struct stat st;
12+
13+ if (stat(fn, &st) != -1) {
14+ if (st.st_size < 100000) {
15+ FILE *f;
16+ if ((f = fopen(fn, "r")) != NULL) {
17+ out = xs_json_load(f);
18+ fclose(f);
19+ }
20+ }
21 }
22
23 return out;