After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 757618 - Patch : Dereferencing a possible NULL pointer in xsltproc.c
Patch : Dereferencing a possible NULL pointer in xsltproc.c
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.x
Other Linux
: Normal major
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2015-11-05 05:26 UTC by mahendra.n
Modified: 2015-12-13 19:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch file (780 bytes, patch)
2015-11-05 05:26 UTC, mahendra.n
none Details | Review

Description mahendra.n 2015-11-05 05:26:28 UTC
Created attachment 314868 [details] [review]
patch file

NULL check is missing on pointer before dereferencing it.
File : xsltproc.c
Function : xsltprocExternalEntityLoader
Line no : 183
version : 1.1.28

Variable 'defaultEntityLoader' is compared to null at line no 161 in xsltproc.c
but dereference at line no 183 without NULL check.

Please check attached patch.
Patch :

 static xmlParserInputPtr
 xsltprocExternalEntityLoader(const char *URL, const char *ID,
                             xmlParserCtxtPtr ctxt) {
-    xmlParserInputPtr ret;
+    xmlParserInputPtr ret =  NULL;
     warningSAXFunc warning = NULL;

     int i;
@@ -180,7 +180,8 @@
        newURL = xmlStrcat(newURL, (const xmlChar *) "/");
        newURL = xmlStrcat(newURL, (const xmlChar *) lastsegment);
        if (newURL != NULL) {
-           ret = defaultEntityLoader((const char *)newURL, ID, ctxt);
+           if (defaultEntityLoader != NULL)
+               ret = defaultEntityLoader((const char *)newURL, ID, ctxt);
            if (ret != NULL) {
                if (warning != NULL)
                    ctxt->sax->warning = warning;