summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
diff options
context:
space:
mode:
authorRené Schümann <white06tiger@gmail.com>2014-06-08 01:10:33 +0000
committerRené Schümann <white06tiger@gmail.com>2014-06-08 01:10:33 +0000
commit5baafa881a2ec9206eeac155fe4bfc0659c2af5c (patch)
tree59743f445501e2b55581a3d28bd8e0228a39f819 /plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
parent5f22034a2628515959a190a22b057512e0fa75a4 (diff)
SendSS:
! fixed possible crash (CSendHost_uploadpie, CSendImageShack) * improved ImageShack error handling by improving GetHTMLContent * improved uploadpie error handling (still ugly, but better non the less) git-svn-id: http://svn.miranda-ng.org/main/trunk@9421 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp')
-rw-r--r--plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
index 0218956559..6a2c7fe48a 100644
--- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp
@@ -67,8 +67,8 @@ void CSendHost_UploadPie::SendThread(void* obj)
NETLIBHTTPREQUEST* reply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&self->m_nlhr);
self->HTTPFormDestroy(&self->m_nlhr);
if(reply){
- if(reply->resultCode>=200 && reply->resultCode<300){
- reply->pData[reply->dataLength]='\0';/// make sure its null terminated
+ if(reply->resultCode>=200 && reply->resultCode<300 && reply->dataLength){
+ reply->pData[reply->dataLength-1]='\0';/// make sure its null terminated
char* url=reply->pData;
do{
char* pos;
@@ -76,7 +76,7 @@ void CSendHost_UploadPie::SendThread(void* obj)
for(pos=url+21; (*pos>='0'&&*pos<='9') || (*pos>='a'&&*pos<='z') || (*pos>='A'&&*pos<='Z') || *pos=='_' || *pos=='-' || *pos=='"' || *pos=='\''; ++pos){
if(*pos=='"' || *pos=='\'') break;
}
- if(*pos=='"' || *pos=='\''){
+ if(url+21!=pos && (*pos=='"' || *pos=='\'')){
*pos='\0';
break;
}
@@ -88,9 +88,12 @@ void CSendHost_UploadPie::SendThread(void* obj)
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)reply);
self->svcSendMsgExit(url); return;
}else{/// check error mess from server
- TCHAR* err=mir_a2t(reply->pData);
- self->Error(_T("%s"),err);
- mir_free(err);
+ const char* err=GetHTMLContent(reply->pData,"<p id=\"error\"","</p>");
+ TCHAR* werr;
+ if(err) werr=mir_a2t(err);
+ else werr=mir_a2t(reply->pData);
+ self->Error(_T("%s"),werr);
+ mir_free(werr);
}
}else{
self->Error(LPGENT("Upload server did not respond timely."));