From e72eda101e58d7933244979486d249a06b3feac6 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Fri, 28 Jun 2024 01:41:36 +0200 Subject: [PATCH] parser: Add NULL check in xmlNewIOInputStream --- parserInternals.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parserInternals.c b/parserInternals.c index f0c5d594..c33e0d10 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -1209,7 +1209,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc) /** * xmlSwitchInputEncodingName: - * @ctxt: the parser context, only for error reporting + * @ctxt: the parser context * @input: the input strea, * @encoding: the encoding name * @@ -2079,7 +2079,7 @@ xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr buf, xmlParserInputPtr input; const char *encoding; - if (buf == NULL) + if ((ctxt == NULL) || (buf == NULL)) return(NULL); input = xmlNewInputInternal(buf, NULL);