The string buffer lengths in a URL_COMPONENTS structure are in TCHARs, so

these should be sizeof(z) / sizeof(z[0]) to avoid a buffer overrun.  Caught
by Dmitry Titov, r=me.


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@229 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai 2007-11-13 22:17:14 +00:00
parent feff0b300f
commit bbd9b47291

View file

@ -83,11 +83,11 @@ bool HTTPUpload::SendRequest(const wstring &url,
memset(&components, 0, sizeof(components)); memset(&components, 0, sizeof(components));
components.dwStructSize = sizeof(components); components.dwStructSize = sizeof(components);
components.lpszScheme = scheme; components.lpszScheme = scheme;
components.dwSchemeLength = sizeof(scheme); components.dwSchemeLength = sizeof(scheme) / sizeof(scheme[0]);
components.lpszHostName = host; components.lpszHostName = host;
components.dwHostNameLength = sizeof(host); components.dwHostNameLength = sizeof(host) / sizeof(host[0]);
components.lpszUrlPath = path; components.lpszUrlPath = path;
components.dwUrlPathLength = sizeof(path); components.dwUrlPathLength = sizeof(path) / sizeof(path[0]);
if (!InternetCrackUrl(url.c_str(), static_cast<DWORD>(url.size()), if (!InternetCrackUrl(url.c_str(), static_cast<DWORD>(url.size()),
0, &components)) { 0, &components)) {
return false; return false;