Alex Henrie : wininet/tests: Fix off-by-one errors in HTTP tests (Coverity ).

Alexandre Julliard julliard at winehq.org
Mon Jan 8 16:08:06 CST 2018


Module: wine
Branch: master
Commit: 7b2ead8da082e27d403f8554f0e714f0603ffd31
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7b2ead8da082e27d403f8554f0e714f0603ffd31

Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Sat Jan  6 21:53:58 2018 -0700

wininet/tests: Fix off-by-one errors in HTTP tests (Coverity).

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wininet/tests/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index efc73e0..1c2aadb 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -720,7 +720,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)-1;
+    length = sizeof(buffer)-2;
     memset(buffer, 0x77, sizeof(buffer));
     res = HttpQueryInfoA(hor,HTTP_QUERY_RAW_HEADERS,buffer,&length,0x0);
     ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
@@ -744,7 +744,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
     ok(buffer[length2+1] == 0x77, "Expected 0x77, got %02X\n", buffer[length2+1]);
     ok(length2 == length, "Value should not have changed: %d != %d\n", length2, length);
 
-    length = sizeof(wbuffer)-sizeof(WCHAR);
+    length = sizeof(wbuffer)-2*sizeof(WCHAR);
     memset(wbuffer, 0x77, sizeof(wbuffer));
     res = HttpQueryInfoW(hor, HTTP_QUERY_RAW_HEADERS, wbuffer, &length, 0x0);
     ok(res, "HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());




More information about the wine-cvs mailing list