mshtml: Don't include null-byte in post data.

This commit is contained in:
Jacek Caban 2011-04-15 19:36:49 +02:00 committed by Alexandre Julliard
parent 0613a82671
commit 1054b95588
1 changed files with 10 additions and 9 deletions

View File

@ -886,7 +886,7 @@ static HRESULT read_post_data_stream(nsChannelBSC *This, nsChannel *nschannel)
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
post_data = data = GlobalAlloc(0, available+1); post_data = data = GlobalAlloc(0, available);
if(!data) if(!data)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -896,21 +896,22 @@ static HRESULT read_post_data_stream(nsChannelBSC *This, nsChannel *nschannel)
return E_FAIL; return E_FAIL;
} }
data[data_len++] = 0;
if(nschannel->post_data_contains_headers) { if(nschannel->post_data_contains_headers) {
if(data[0] == '\r' && data[1] == '\n') { if(data_len >= 2 && data[0] == '\r' && data[1] == '\n') {
post_data = data+2; post_data = data+2;
data_len -= 2; data_len -= 2;
}else { }else {
WCHAR *headers; WCHAR *headers;
DWORD size; DWORD size;
char *ptr;
post_data = strstr(data, "\r\n\r\n"); post_data += data_len;
if(post_data) for(ptr = data; ptr+4 < data+data_len; ptr++) {
post_data += 4; if(!memcmp(ptr, "\r\n\r\n", 4)) {
else post_data = ptr+4;
post_data = data+data_len; break;
}
}
data_len -= post_data-data; data_len -= post_data-data;