diff options
| author | 2026-02-10 17:45:12 +0100 | |
|---|---|---|
| committer | 2026-02-10 17:45:12 +0100 | |
| commit | 8c78d89041b713bffcb0b09fee4468304a3a54d5 (patch) | |
| tree | 2c9427e2382b47c2aaf724a074fadafde415c066 /src/plist.h | |
| parent | 9ef0d05265198ede1fd14271ab3f4812d34ebe2e (diff) | |
| download | libplist-8c78d89041b713bffcb0b09fee4468304a3a54d5.tar.gz libplist-8c78d89041b713bffcb0b09fee4468304a3a54d5.tar.bz2 | |
plist: Make plist copy and free implementations iterative
Convert plist_free_node() and plist_copy_node() to iterative
implementations. This avoids unbounded recursion and stack
overflow when handling deeply nested plist data, while
preserving existing semantics and caches.
Diffstat (limited to 'src/plist.h')
| -rw-r--r-- | src/plist.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plist.h b/src/plist.h index e310bcc..7228696 100644 --- a/src/plist.h +++ b/src/plist.h | |||
| @@ -49,9 +49,15 @@ | |||
| 49 | #endif | 49 | #endif |
| 50 | #endif | 50 | #endif |
| 51 | 51 | ||
| 52 | #include "node.h" | ||
| 53 | |||
| 52 | #ifndef PLIST_MAX_NESTING_DEPTH | 54 | #ifndef PLIST_MAX_NESTING_DEPTH |
| 55 | #ifdef NODE_MAX_DEPTH | ||
| 56 | #define PLIST_MAX_NESTING_DEPTH NODE_MAX_DEPTH | ||
| 57 | #else | ||
| 53 | #define PLIST_MAX_NESTING_DEPTH 512 | 58 | #define PLIST_MAX_NESTING_DEPTH 512 |
| 54 | #endif | 59 | #endif |
| 60 | #endif | ||
| 55 | 61 | ||
| 56 | #include "plist/plist.h" | 62 | #include "plist/plist.h" |
| 57 | 63 | ||
