mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-07-07 11:00:44 +00:00
Fix a crash when attempting to upload a zero-length dump file (#83) r=mmentovai
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@71 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
4365e2fe41
commit
c297c50f83
|
@ -226,7 +226,9 @@ bool HTTPUpload::GenerateRequestBody(const map<wstring, wstring> ¶meters,
|
||||||
request_body->append("Content-Type: application/octet-stream\r\n");
|
request_body->append("Content-Type: application/octet-stream\r\n");
|
||||||
request_body->append("\r\n");
|
request_body->append("\r\n");
|
||||||
|
|
||||||
request_body->append(&(contents[0]), contents.size());
|
if (!contents.empty()) {
|
||||||
|
request_body->append(&(contents[0]), contents.size());
|
||||||
|
}
|
||||||
request_body->append("\r\n");
|
request_body->append("\r\n");
|
||||||
request_body->append("--" + boundary_str + "--\r\n");
|
request_body->append("--" + boundary_str + "--\r\n");
|
||||||
return true;
|
return true;
|
||||||
|
@ -249,8 +251,10 @@ void HTTPUpload::GetFileContents(const wstring &filename,
|
||||||
file.seekg(0, ios::end);
|
file.seekg(0, ios::end);
|
||||||
int length = file.tellg();
|
int length = file.tellg();
|
||||||
contents->resize(length);
|
contents->resize(length);
|
||||||
file.seekg(0, ios::beg);
|
if (length != 0) {
|
||||||
file.read(&((*contents)[0]), length);
|
file.seekg(0, ios::beg);
|
||||||
|
file.read(&((*contents)[0]), length);
|
||||||
|
}
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
contents->clear();
|
contents->clear();
|
||||||
|
|
Loading…
Reference in a new issue