summaryrefslogtreecommitdiffstats
path: root/src/xplist.c
AgeCommit message (Collapse)AuthorFilesLines
2021-12-19Add support for PLIST_NULL typeGravatar Nikias Bassen1-5/+19
2021-12-19Add new plist_mem_free() functionGravatar Nikias Bassen1-5/+0
Thanks to @azerg for bringing this to my attention. Instead of having multiple (internally identical) plist_*_free() functions, this commit introduces a single plist_mem_free() that can be used to free the memory allocated by plist_to_xml(), plist_to_bin(), plist_get_key_val(), plist_get_string_val(), and plist_get_data_val(). Note: This commit REMOVES plist_to_bin_free() and plist_to_xml_free().
2021-11-08xplist: Better size estimation for PLIST_REAL nodesGravatar Nikias Bassen1-2/+2
2021-06-22[clang-tidy] Remove casts to the same typeGravatar Rosen Penev1-1/+1
Found with google-readability-casting Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-01-25Replace malloc + memset with calloc where appropriateGravatar Rosen Penev1-2/+1
calloc is faster for big allocations. It's also simpler. Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-11-24Add parentheses to macros for better readabilityGravatar Rosen Penev1-1/+1
[clang-tidy] Found with bugprone-macro-parentheses Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-11-24Improve code readability by using explicit != 0 compare when using strncmpGravatar Rosen Penev1-4/+4
[clang-tidy] Found with bugprone-suspicious-string-compare Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-03Remove pointless return in void functionsGravatar Rosen Penev1-2/+0
[clang-tidy] Found with readability-redundant-control-flow Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-07xplist: Bail out when '.' is found while checking for ',' in double to ↵Gravatar Nikias Bassen1-0/+2
string conversion
2019-11-07Add plist_to_bin_free() and plist_to_xml_free() functions that free memory ↵Gravatar Nikias Bassen1-0/+5
allocated by plist_to_bin()/plist_to_xml()
2019-11-07xplist: Increase precision when converting PLIST_REAL nodes to XMLGravatar Nikias Bassen1-37/+16
2019-01-21xplist: Fix dtostr() inserting ':' to output string when fractional part ↵Gravatar Nikias Bassen1-2/+15
overflows
2018-12-17xplist: Write base64 directly to output buffer to improve memory usageGravatar Nikias Bassen1-5/+2
Now that we grow the output buffer enough before writing XML output we can just write the base64 encoded data directly to the ouput buffer instead of using a heap buffer that will then be copied to the output buffer. This makes writing XML output more memory efficient (and slightly faster).
2018-12-14xplist: Improve memory usage by estimating output buffer sizeGravatar Nikias Bassen1-2/+127
2018-12-14xplist: Fix writing of empty dict and array nodes to XMLGravatar Nikias Bassen1-8/+6
2018-12-11xplist: Fix segfault caused by recent changes in libcnaryGravatar Nikias Bassen1-1/+1
2018-12-10xplist: Prevent unnecessary reallocations when writing XML outputGravatar Nikias Bassen1-1/+4
2018-12-10Remove node_iterator and operate on node list directly to improve memory usageGravatar Nikias Bassen1-4/+1
2018-09-04xplist: Assert when number of child nodes of PLIST_DICT is not evenGravatar Nikias Bassen1-0/+3
This should only happen due to misuse of the library, e.g. when calling plist_free() on a node that is a value node in a PLIST_DICT without properly removing the dictionary entry (key/value pair) and then calling plist_to_xml() on that dictionary.
2018-07-25xplist: Fix typo in error messageGravatar Bastien Nocera1-1/+1
2017-04-02xplist: Plug another memory leakGravatar Nikias Bassen1-0/+3
Credit to OSS-Fuzz
2017-03-29xplist: Prevent memory leak(s) when parsing failsGravatar Nikias Bassen1-2/+2
Credit to OSS-Fuzz
2017-03-29xplist: Make XML parsing non-recursive to prevent stack overflow on ↵Gravatar Nikias Bassen1-79/+103
deep-structured plists Credit to OSS-Fuzz
2017-02-15xplist: Improve writing of large PLIST_DATA nodes by growing buffer in advanceGravatar Nikias Bassen1-0/+1
Instead of letting the buffer grow by just the amount of bytes currently transformed to base64 - which is basically line by line - we now calculate the size of the output blob in advance and grow the buffer accordingly. This will reduce the amount of reallocs to just one, which is especially important for large data blobs. While this is a general improvement for all platforms, it is on platforms like Windows where realloc() can be REALLY slow; converting a 20mb blob to XML can easily take up to a minute (due to the several hundred thousand calls to realloc()). With this commit, it will be fast again.
2017-02-09xplist: Fix OOB heap buffer read with empty data nodesGravatar Nikias Bassen1-2/+4
Credit to OSS-Fuzz
2017-02-09xplist: Prevent assert when parsing CF$UID dict with invalid value nodeGravatar Nikias Bassen1-0/+5
Credit to OSS-Fuzz
2017-02-08xplist: Use proper variable size for integer from string parsingGravatar Nikias Bassen1-2/+2
2017-02-07xplist: Prevent some more strncmp related OOB readsGravatar Nikias Bassen1-4/+4
2017-02-07xplist: Really fix OOB read when parsing DOCTYPEGravatar Nikias Bassen1-1/+1
2017-02-07xplist: unescape_entities(): Make sure text part buffer is null terminated ↵Gravatar Nikias Bassen1-0/+1
after strncpy
2017-02-07xplist: Fix OOB read when parsing DOCTYPEGravatar Nikias Bassen1-1/+1
2017-02-07xplist: Also fix OOB read in find_char() and find_str() functionsGravatar Nikias Bassen1-0/+8
2017-02-07xplist: Prevent OOB read in two more casesGravatar Nikias Bassen1-0/+10
2017-02-07xplist: Fix OOB read when parsing double quotesGravatar Nikias Bassen1-0/+4
2017-02-07xplist: Fix OOB read when parsing node text contentGravatar Nikias Bassen1-1/+1
2017-02-07xplist: Catch some more error conditionsGravatar Nikias Bassen1-34/+37
2017-02-06xplist: Prevent memory leaks when parsing failsGravatar Nikias Bassen1-37/+20
2017-01-03xplist: Refine XML parsing error messagesGravatar Nikias Bassen1-15/+18
2017-01-02xplist: Error out when invalid tags inside text nodes are encounteredGravatar Nikias Bassen1-2/+12
2017-01-02xplist: Make sure to error out when encountering empty/incomplete entitiesGravatar Nikias Bassen1-1/+5
2017-01-02xplist: Make sure to not parse for entities in empty stringsGravatar Nikias Bassen1-1/+1
2017-01-02xplist: Allow empty keys in dictionariesGravatar Nikias Bassen1-2/+2
2017-01-02xplist: Allow whitespace after name in closing tagGravatar Nikias Bassen1-2/+7
'</key >' is a perfectly valid closing tag and so is '</key >' (note the newline). This commit will make the parser skip any encountered whitespace before checking for the closing '>'.
2017-01-01xplist: Fix numerical character entity conversionGravatar Nikias Bassen1-2/+6
2016-12-21xplist: Fix UaF in code checking for closing tagGravatar Nikias Bassen1-2/+2
2016-12-21xplist: Make sure to correctly parse for closing tags of structured nodesGravatar Nikias Bassen1-7/+45
2016-12-21xplist: Make sure to stop parsing on entity errorsGravatar Nikias Bassen1-7/+11
2016-12-14xplist: Remove usage of strlen() wherever possibleGravatar Nikias Bassen1-45/+66
2016-12-14xplist: Improve text content parsing, reducing memory usage and unneeded copyingGravatar Nikias Bassen1-113/+318
2016-12-14Properly check for the availability of strptime() and make sure to use itGravatar Nikias Bassen1-1/+5