Ticket #3927: mythsoap-null-terminate.patch
File mythsoap-null-terminate.patch, 1.2 KB (added by , 18 years ago) |
---|
-
mythmovies/ignyte/mythsoap.cpp
1 #include <mythtv/mythcontext.h>2 3 1 #include "mythsoap.h" 2 #include <iostream> 4 3 5 4 void MythSoap::doSoapRequest(QString host, QString path, QString soapAction, 6 5 QString query) … … 35 34 36 35 void MythSoap::httpDone(bool error) 37 36 { 37 using namespace std; 38 38 if (error) 39 39 { 40 40 cerr << "Error in mythsoap.o retrieving data: " << http.errorString() << endl << flush; 41 41 } 42 42 else 43 43 { 44 m_data = http.readAll(); 45 //cout << "Data: " << m_data.data() << endl << flush; 44 const Q_ULONG len = http.bytesAvailable(); 45 // QMemArray::assign() will own this so we don't have to delete it 46 char* buffer = new char[len + 1]; 47 if(buffer) { 48 http.readBlock(buffer, len); 49 buffer[len] = '\0'; 50 m_data.assign(buffer, len + 1); 51 //cout << "Data: " << m_data.data() << endl << flush; 52 } else { 53 cerr << "Failed to alloc memory in mythsoap.o" << endl; 54 } 46 55 } 47 56 m_done = true; 48 57 }