summaryrefslogtreecommitdiffstats
path: root/src/out-plutil.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-01-17 15:18:06 +0100
committerGravatar Nikias Bassen2026-01-17 16:04:00 +0100
commite45099fb21b679aa0cdb0db394587bb5ba675b0c (patch)
treeb1a2c1dd34877d83a04d6d6fab804fb2e5a65f2d /src/out-plutil.c
parent26dd27c435a0d110c924e1fef34ad0f6ae60e251 (diff)
downloadlibplist-e45099fb21b679aa0cdb0db394587bb5ba675b0c.tar.gz
libplist-e45099fb21b679aa0cdb0db394587bb5ba675b0c.tar.bz2
Prevent deep nesting of plist structures in all input/output formats
Thanks to @unbengable12 for reporting. Addresses #288, #289, #290, #291, and #292.
Diffstat (limited to 'src/out-plutil.c')
-rw-r--r--src/out-plutil.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/out-plutil.c b/src/out-plutil.c
index 5354aa3..bf9e72e 100644
--- a/src/out-plutil.c
+++ b/src/out-plutil.c
@@ -312,6 +312,13 @@ static plist_err_t _node_estimate_size(node_t node, uint64_t *size, uint32_t dep
312 return PLIST_ERR_INVALID_ARG; 312 return PLIST_ERR_INVALID_ARG;
313 } 313 }
314 314
315 if (depth > PLIST_MAX_NESTING_DEPTH) {
316#if DEBUG
317 fprintf(stderr, "libplist: ERROR: maximum nesting depth (%u) exceeded\n", (unsigned)PLIST_MAX_NESTING_DEPTH);
318#endif
319 return PLIST_ERR_MAX_NESTING;
320 }
321
315 if (hash_table_lookup(visited, node)) { 322 if (hash_table_lookup(visited, node)) {
316#if DEBUG 323#if DEBUG
317 fprintf(stderr, "libplist: ERROR: circular reference detected\n"); 324 fprintf(stderr, "libplist: ERROR: circular reference detected\n");