From 5ae742e8e12fda496fbaadbf0c5f93cffbb3ad92 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sat, 9 Nov 2013 15:11:35 +0100 Subject: [PATCH] plugins/xslt: fail early if content_type is null Fixes null pointer dereference. Reported by Coverity as CID #1125161 --- plugins/xslt/xslt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/xslt/xslt.c b/plugins/xslt/xslt.c index 1c930013..4e78aee1 100644 --- a/plugins/xslt/xslt.c +++ b/plugins/xslt/xslt.c @@ -399,10 +399,10 @@ static int uwsgi_routing_func_xslt(struct wsgi_request *wsgi_req, struct uwsgi_r if (!ub_params) goto end; } - if (urxc->content_type) { - ub_content_type = uwsgi_routing_translate(wsgi_req, ur, *subject, *subject_len, urxc->content_type, urxc->content_type_len); - if (!ub_content_type) goto end; - } + if (!urxc->content_type) goto end; + + ub_content_type = uwsgi_routing_translate(wsgi_req, ur, *subject, *subject_len, urxc->content_type, urxc->content_type_len); + if (!ub_content_type) goto end; int rlen; xmlDoc *doc = xmlParseFile(ub_doc->buf) ;