From e6e8eb9d9301f48855cba0decdfc2456c03f519b Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 28 Jun 2015 15:13:14 +0200 Subject: [PATCH] lib/libupnpclient fix segfault if parser is NULL --- lib/libupnpclient/UPNPDevice.cpp | 3 +++ lib/libupnpclient/UPNPService.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/libupnpclient/UPNPDevice.cpp b/lib/libupnpclient/UPNPDevice.cpp index 2775f115e..aa79534c2 100644 --- a/lib/libupnpclient/UPNPDevice.cpp +++ b/lib/libupnpclient/UPNPDevice.cpp @@ -170,6 +170,9 @@ CUPnPDevice::CUPnPDevice(std::string url) throw std::runtime_error(std::string("description url returned ") + rcode); xmlDocPtr parser = parseXml(body.c_str(),charset.c_str()); + if(!parser) + throw std::runtime_error(std::string("XML: parser error")); + root = xmlDocGetRootElement(parser); if (!root) throw std::runtime_error(std::string("XML: no root node")); diff --git a/lib/libupnpclient/UPNPService.cpp b/lib/libupnpclient/UPNPService.cpp index 651471e4b..349b19912 100644 --- a/lib/libupnpclient/UPNPService.cpp +++ b/lib/libupnpclient/UPNPService.cpp @@ -99,6 +99,9 @@ std::list CUPnPService::SendSOAP(std::string action, std::list