wininet: Reading past end-of-file in chunked mode returns success.

Found by Andrew Eikum.
This commit is contained in:
Hans Leidekker 2013-11-21 17:52:54 +01:00 committed by Alexandre Julliard
parent e8eb781327
commit a448bbf880
2 changed files with 8 additions and 3 deletions

View file

@ -2761,7 +2761,7 @@ static DWORD start_next_chunk(chunked_stream_t *stream, http_request_t *req)
assert(!stream->chunk_size || stream->chunk_size == ~0u);
if (stream->end_of_data) return ERROR_NO_MORE_FILES;
if (stream->end_of_data) return ERROR_SUCCESS;
/* read terminator for the previous chunk */
if(!stream->chunk_size && (res = discard_chunked_eol(stream, req)) != ERROR_SUCCESS)

View file

@ -734,7 +734,7 @@ static void InternetReadFile_chunked_test(void)
{
BOOL res;
CHAR buffer[4000];
DWORD length;
DWORD length, got;
const char *types[2] = { "*", NULL };
HINTERNET hi, hic = 0, hor = 0;
@ -814,7 +814,6 @@ static void InternetReadFile_chunked_test(void)
trace("got %u available\n",length);
if (length)
{
DWORD got;
char *buffer = HeapAlloc(GetProcessHeap(),0,length+1);
res = InternetReadFile(hor,buffer,length,&got);
@ -828,7 +827,13 @@ static void InternetReadFile_chunked_test(void)
if (!got) break;
}
if (length == 0)
{
got = 0xdeadbeef;
res = InternetReadFile( hor, buffer, 1, &got );
ok( res, "InternetReadFile failed: %u\n", GetLastError() );
ok( !got, "got %u\n", got );
break;
}
}
abort:
trace("aborting\n");