[PATCH] wininet: do avoid overwriting the buffer (Coverity)

Marcus Meissner marcus at jet.franken.de
Sun May 26 07:40:12 CDT 2013


If we get RAW headers of exactly sizeof(buffer) bytes,
this buffer[length] will write a 0 just after the end
of the buffer.

CID 731816
---
 dlls/wininet/tests/http.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 60fbe57..b42e732 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -613,7 +613,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
     res = InternetQueryOptionA(hor,INTERNET_OPTION_URL,buffer,&length);
     ok(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed with error %d\n", GetLastError());
 
-    length = sizeof(buffer);
+    length = sizeof(buffer)-1;
     res = HttpQueryInfoA(hor,HTTP_QUERY_RAW_HEADERS,buffer,&length,0x0);
     ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
     buffer[length]=0;
-- 
1.7.10.4




More information about the wine-patches mailing list