diff options
author | bryner <bryner@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-11-27 18:38:39 +0000 |
---|---|---|
committer | bryner <bryner@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-11-27 18:38:39 +0000 |
commit | c297c50f83344a35712c69563f75a70a3e3182e1 (patch) | |
tree | a6e04e4144ee8322adb1ba60a0d37825d9b0ced8 /src | |
parent | Support GUID-less PDBs (#77). r=bryner (diff) | |
download | breakpad-c297c50f83344a35712c69563f75a70a3e3182e1.tar.xz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/common/windows/http_upload.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/common/windows/http_upload.cc b/src/common/windows/http_upload.cc index 8e5328b5..54e7ff85 100644 --- a/src/common/windows/http_upload.cc +++ b/src/common/windows/http_upload.cc @@ -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("\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("--" + boundary_str + "--\r\n"); return true; @@ -249,8 +251,10 @@ void HTTPUpload::GetFileContents(const wstring &filename, file.seekg(0, ios::end); int length = file.tellg(); contents->resize(length); - file.seekg(0, ios::beg); - file.read(&((*contents)[0]), length); + if (length != 0) { + file.seekg(0, ios::beg); + file.read(&((*contents)[0]), length); + } file.close(); } else { contents->clear(); |