summaryrefslogtreecommitdiff
path: root/xmllint.c
Commit message (Collapse)AuthorAgeFilesLines
* Stop calling xmlMemoryDumpNick Wellnhofer2023-04-301-1/+0
| | | | | | This was used to check for memory leaks but could potentially create a .memdump file. These days, there are better ways to check for memory leaks.
* xmllint: Validate --maxmem integer optionNick Wellnhofer2023-04-201-4/+21
| | | | Fixes #520.
* xmllint: Fix memory leak with --pattern --streamNick Wellnhofer2023-03-141-9/+0
| | | | Fixes #499.
* xmllint: Fix use-after-free with --maxmemNick Wellnhofer2023-03-141-9/+6
| | | | Fixes #498.
* libxml.h: Don't include stdio.hNick Wellnhofer2022-12-081-0/+1
|
* Remove XMLDECL macro from .c filesNick Wellnhofer2022-12-081-9/+9
|
* Remove hacky heuristic from b2dc5675e94aa6b5557ba63f7d66b0f08dd17e4dAlex Richardson2022-12-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | Checking whether the context is close to the parent context by hardcoding 250 is not portable (I noticed tests were failing on Morello since the value is 288 there due to pointers being 128 bits). Instead we should ensure that the XML_VCTXT_USE_PCTXT flag is not set in cases where the user data is not actually a parser context (or ideally add a separate field but that would be an ABI break. From what I can see in the source, the XML_VCTXT_USE_PCTXT is only set if the userData field points to a valid context, and if this is not the case the flag should be cleared when changing userData rather than relying on the offset between the two. Looking at the history, I think d7cb33cf44aa688f24215c9cd398c1a26f0d25ff fixed most of the need for this workaround, but it looks like there are a few more locations that need updating; This commit changes two more places to set/clear/copy the XML_VCTXT_USE_PCTXT flag, so this heuristic should not be needed anymore. I've also drop two = NULL assignment in xmllint since this is not needed after a call to memset(). There was also an uninitialized vctxt.flags (and other fields) in `xmlShellValidate()`, which I've fixed by adding a memset() call.
* xmllint: Include <io.h> on WindowsNick Wellnhofer2022-11-221-0/+2
|
* xmllint: Improve handling of empty XPath node setsNick Wellnhofer2022-10-191-2/+3
| | | | | | | Don't return an error if the result is an empty node set. Suppress the "XPath set is empty" message in quiet mode. Fixes #180.
* Stop including sys/types.hNick Wellnhofer2022-09-021-3/+0
|
* xmllint: Don't set deprecated globalsNick Wellnhofer2022-08-241-37/+17
| | | | Setting parser options should be enough.
* xmllint: Stop calling xmlSAXDefaultVersionNick Wellnhofer2022-08-241-7/+0
| | | | This should already be handled by setting XML_PARSE_SAX1.
* Introduce xmlNewSAXParserCtxt and htmlNewSAXParserCtxtNick Wellnhofer2022-08-241-33/+12
| | | | | Add API functions to create a parser context with a custom SAX handler without having to mess with ctxt->sax manually.
* Respect `--sysconfdir` in source filesDavid Seifert2022-03-301-1/+1
| | | | | | | | * Prefix installations need to point to a non-root `etc` - Gentoo Prefix has been patching this for over 10 years: https://bugs.gentoo.org/317891 - MacPorts has to manually replace paths after patching: https://github.com/macports/macports-ports/blob/cc3bb736e906abe73b014da02a89ae2b70ef6295/textproc/libxml2/Portfile#L46
* Don't check for standard C89 headersNick Wellnhofer2022-03-021-45/+3
| | | | | | | | | | | | | | | | | | | | Don't check for - ctype.h - errno.h - float.h - limits.h - math.h - signal.h - stdarg.h - stdlib.h - string.h - time.h Stop including non-standard headers - malloc.h - strings.h
* Remove useless call to xmlRelaxNGCleanupTypesNick Wellnhofer2022-03-011-1/+0
| | | | xmlRelaxNGCleanupTypes is called from xmlCleanupParser later.
* Always fopen files with "rb"Nick Wellnhofer2022-02-281-19/+1
| | | | | | We never want translation of newlines when reading files, so it should be safe to always specify "rb". On sane platforms, the "b" flag is simply ignored.
* Remove __DJGPP__ checksNick Wellnhofer2022-02-281-3/+3
| | | | Drop broken support for DJGPP.
* Remove useless __CYGWIN__ checksNick Wellnhofer2022-02-281-3/+3
| | | | | | | | | | From what I can tell, some really early Cygwin versions from around 1998-2000 used to erroneously define _WIN32. This was eventually fixed, but these days, the `defined(_WIN32) && !defined(__CYGWIN__)` idiom is unnecessary. Now, we only check for __CYGWIN__ in xmlexports.h when deciding whether to use __declspec.
* Fix unused variable warnings with disabled featuresNick Wellnhofer2022-02-221-0/+3
|
* Redirect links to xmlsoft.orgNick Wellnhofer2022-02-131-2/+1
| | | | Documentation and releases are now available on gitlab.gnome.org.
* Fix "xmllint -"Nick Wellnhofer2022-02-071-1/+1
| | | | Short-lived regression from commit d12be00d.
* Don't ignore xmllint options after "-"Nick Wellnhofer2022-02-041-5/+1
| | | | | | | There's no reason to ignore options after "-". This was probably confused with the "--" mechanism which xmllint doesn't implement. Fixes #290.
* Fix parsing of xmllint --maxmem optionNick Wellnhofer2022-02-011-4/+3
| | | | Fixes #195.
* Add more checks for malloc failures in xmllint.cNick Wellnhofer2022-02-011-28/+84
| | | | | | | Also fix a few of the existing checks. Fixes #197. Fixes #198.
* Make xmllint return an error if arguments are missingNick Wellnhofer2022-01-311-2/+3
| | | | | | | Before, xmllint would only return an error code if the argument list was completely empty. Fixes #285.
* Fix xmllint --maxmemNick Wellnhofer2022-01-161-6/+21
| | | | | | | xmlMemSetup must be called before initializing the parser, otherwise some data structures will be allocated with system malloc instead of our custom allocator. This throws off built-in memory debugging and sanitizers.
* Fix dangling pointer with `xmllint --dropdtd`Nick Wellnhofer2021-04-221-0/+1
| | | | Reset doc->intSubset when dropping the DTD.
* Fix use-after-free with `xmllint --html --push`Nick Wellnhofer2021-04-211-1/+1
| | | | | | | | | Call htmlCtxtUseOptions to make sure that names aren't stored in dictionaries. Note that this issue only affects xmllint using the HTML push parser. Fixes #230.
* Add a flag to not output anything when xmllint succeededhhb2021-02-201-5/+20
|
* Make "xmllint --push --recovery" workNick Wellnhofer2020-08-171-1/+1
|
* Fix out-of-bounds read with 'xmllint --htmlout'Nick Wellnhofer2020-08-071-0/+6
| | | | | | | | | | Make sure that truncated UTF-8 sequences don't cause an out-of-bounds array access. Thanks to @SuhwanSong and the Agency for Defense Development (ADD) for the report. Fixes #178.
* Make 'xmllint --html --push -' read from stdinNick Wellnhofer2020-07-151-3/+7
|
* Fix typosNick Wellnhofer2020-03-081-1/+1
| | | | Resolves #133.
* Large batch of typo fixesJared Yanovich2019-09-301-1/+1
| | | | Closes #109.
* Fix build without reader but with patternNick Wellnhofer2019-06-251-1/+1
| | | | Broken by commit dbc6b55b.
* Fix warnings when compiling without reader or push parserNick Wellnhofer2019-05-161-20/+16
|
* Fix xmllint dump of XPath namespace nodesNick Wellnhofer2019-03-131-1/+1
| | | | | | Starting with commit da35eeae, xmllint uses the xmlNodeDump API to dump XPath nodes. Make sure not to access node->doc which doesn't work with namespace nodes.
* Fix -Wcast-function-type warnings (GCC 8)Nick Wellnhofer2019-01-061-34/+16
| | | | | Use xmlGenericError instead of fprintf as error handler. It also prints to stderr by default.
* Add newlines to 'xmllint --xpath' outputNick Wellnhofer2018-09-231-12/+13
| | | | | | | | Separate nodes in a node-set with newlines and always add a terminating newline. This is a breaking change but the old behavior of dumping text nodes without separator was mostly useless. Also use buffered I/O when dumping node-sets.
* Fix libz and liblzma detectionNick Wellnhofer2017-11-271-2/+2
| | | | | | | | | If libz or liblzma are detected with pkg-config, AC_CHECK_HEADERS must not be run because the correct CPPFLAGS aren't set. It is actually not required have separate checks for LIBXML_ZLIB_ENABLED and HAVE_ZLIB_H. Only check for LIBXML_ZLIB_ENABLED and remove HAVE_ZLIB_H macro. Fixes bug 764657, bug 787041.
* Fix IO callback signaturesNick Wellnhofer2017-11-091-13/+11
|
* Don't include winsock2.h in xmllint.cNick Wellnhofer2017-10-091-14/+0
| | | | | | I'm not sure why xmllint.c did include winsock2.h at all. Stop including the header as both MinGW and MSVC builds don't seem to require it.
* socklen_t is always int on WindowsNick Wellnhofer2017-10-091-2/+0
| | | | | Define XML_SOCKLEN_T as `int` unconditionally in wsockcompat.h. Fixes compiler warnings and removes some duplicated code.
* Send xmllint usage error to stderrNick Wellnhofer2017-07-041-78/+78
| | | | Fixes bug 781459.
* Revert "Add an XML_PARSE_NOXXE flag to block all entities loading even local"Nick Wellnhofer2017-06-061-5/+0
| | | | | | | This reverts commit 2304078555896cf1638c628f50326aeef6f0e0d0. The new flag doesn't work and the change even broke the XML_PARSE_NONET option.
* Add an XML_PARSE_NOXXE flag to block all entities loading even localDoran Moppert2017-04-071-0/+5
| | | | | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=772726 * include/libxml/parser.h: Add a new parser flag XML_PARSE_NOXXE * elfgcchack.h, xmlIO.h, xmlIO.c: associated loading routine * include/libxml/xmlerror.h: new error raised * xmllint.c: adds --noxxe flag to activate the option
* Fix some format string warnings with possible format string vulnerabilityDavid Kilzer2016-05-231-10/+10
| | | | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=761029 Decorate every method in libxml2 with the appropriate LIBXML_ATTR_FORMAT(fmt,args) macro and add some cleanups following the reports.
* Fix null pointer deref in docs with no root elementHugh Davenport2016-05-041-0/+6
| | | | From https://bugzilla.gnome.org/show_bug.cgi?id=758514
* xmllint: flush stdout before interactive shell input.Patrick Monnerat2016-05-011-0/+1
|