diff options
| author | 2026-02-12 01:20:05 +0100 | |
|---|---|---|
| committer | 2026-02-12 01:20:05 +0100 | |
| commit | 4e82bc85671cfe50763de2637b54cb8576d7976f (patch) | |
| tree | 378d7d8c51e9a6a618e0f45aa6edf97e56bd3c1c /src/xplist.c | |
| parent | 8c78d89041b713bffcb0b09fee4468304a3a54d5 (diff) | |
| download | libplist-4e82bc85671cfe50763de2637b54cb8576d7976f.tar.gz libplist-4e82bc85671cfe50763de2637b54cb8576d7976f.tar.bz2 | |
Add NULL checks across codebase
Diffstat (limited to 'src/xplist.c')
| -rw-r--r-- | src/xplist.c | 16 |
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) | |||
| 1216 | goto handle_closing; | 1216 | goto handle_closing; |
| 1217 | } | 1217 | } |
| 1218 | plist_data_t data = plist_new_plist_data(); | 1218 | plist_data_t data = plist_new_plist_data(); |
| 1219 | if (!data) { | ||
| 1220 | PLIST_XML_ERR("failed to allocate plist data\n"); | ||
| 1221 | ctx->err = PLIST_ERR_NO_MEM; | ||
| 1222 | goto err_out; | ||
| 1223 | } | ||
| 1219 | subnode = plist_new_node(data); | 1224 | subnode = plist_new_node(data); |
| 1225 | if (!subnode) { | ||
| 1226 | PLIST_XML_ERR("failed to create node\n"); | ||
| 1227 | ctx->err = PLIST_ERR_NO_MEM; | ||
| 1228 | goto err_out; | ||
| 1229 | } | ||
| 1220 | 1230 | ||
| 1221 | if (!strcmp(tag, XPLIST_DICT)) { | 1231 | if (!strcmp(tag, XPLIST_DICT)) { |
| 1222 | data->type = PLIST_DICT; | 1232 | data->type = PLIST_DICT; |
| @@ -1425,6 +1435,12 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist) | |||
| 1425 | size_t size = tp->length; | 1435 | size_t size = tp->length; |
| 1426 | if (size > 0) { | 1436 | if (size > 0) { |
| 1427 | data->buff = base64decode(str_content, &size); | 1437 | data->buff = base64decode(str_content, &size); |
| 1438 | if (!data->buff) { | ||
| 1439 | text_parts_free((text_part_t*)first_part.next); | ||
| 1440 | PLIST_XML_ERR("failed to decode base64 stream\n"); | ||
| 1441 | ctx->err = PLIST_ERR_NO_MEM; | ||
| 1442 | goto err_out; | ||
| 1443 | } | ||
| 1428 | data->length = size; | 1444 | data->length = size; |
| 1429 | } | 1445 | } |
| 1430 | 1446 | ||
