summaryrefslogtreecommitdiffstats
path: root/src/xplist.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-02-12 01:20:05 +0100
committerGravatar Nikias Bassen2026-02-12 01:20:05 +0100
commit4e82bc85671cfe50763de2637b54cb8576d7976f (patch)
tree378d7d8c51e9a6a618e0f45aa6edf97e56bd3c1c /src/xplist.c
parent8c78d89041b713bffcb0b09fee4468304a3a54d5 (diff)
downloadlibplist-4e82bc85671cfe50763de2637b54cb8576d7976f.tar.gz
libplist-4e82bc85671cfe50763de2637b54cb8576d7976f.tar.bz2
Add NULL checks across codebase
Diffstat (limited to 'src/xplist.c')
-rw-r--r--src/xplist.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/xplist.c b/src/xplist.c
index 6100afc..73e2b9f 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -1216,7 +1216,17 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist)
goto handle_closing;
}
plist_data_t data = plist_new_plist_data();
+ if (!data) {
+ PLIST_XML_ERR("failed to allocate plist data\n");
+ ctx->err = PLIST_ERR_NO_MEM;
+ goto err_out;
+ }
subnode = plist_new_node(data);
+ if (!subnode) {
+ PLIST_XML_ERR("failed to create node\n");
+ ctx->err = PLIST_ERR_NO_MEM;
+ goto err_out;
+ }
if (!strcmp(tag, XPLIST_DICT)) {
data->type = PLIST_DICT;
@@ -1425,6 +1435,12 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist)
size_t size = tp->length;
if (size > 0) {
data->buff = base64decode(str_content, &size);
+ if (!data->buff) {
+ text_parts_free((text_part_t*)first_part.next);
+ PLIST_XML_ERR("failed to decode base64 stream\n");
+ ctx->err = PLIST_ERR_NO_MEM;
+ goto err_out;
+ }
data->length = size;
}