[PATCH] check if buffer has overflowed potentially

Marcus Meissner marcus at jet.franken.de
Wed Jan 23 15:26:58 CST 2008


Hi,

Coverity spotted that we might have len==256
(not likely, but just check it).

Ciao, Marcus
---
 dlls/wininet/tests/http.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index ec2df72..457a65f 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -999,7 +999,7 @@ static void HttpHeaders_test(void)
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test1")==0, "incorrect string was returned(%s)\n",buffer);
     ok(len == 5, "Invalid length (exp. 5, got %d)\n", len);
-    ok(buffer[len] == 0, "Buffer not NULL-terminated\n"); /* len show only 5 characters but the buffer is NULL-terminated*/
+    ok((len < sizeof(buffer)) && (buffer[len] == 0), "Buffer not NULL-terminated\n"); /* len show only 5 characters but the buffer is NULL-terminated*/
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
     ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
-- 
1.5.2.4



More information about the wine-patches mailing list