wininet: Increase buffer in _test_status_code to avoid potential potential overflow.

Gerald Pfeifer gerald at
Sun Oct 2 05:15:40 CDT 2016

In _test_status_code exbuf is char[10], but we then use this in
  sprintf(exbuf, "%u", excode) 
which can, in principle, print 10 digits plus the final \0, thus
11 chars.

I opted to make the buffer 12 chars instead of only 11, for simplicity, 
to technically also be large enough for signed values, and since with 
natural variable alignment this doesn't actually cost us anything.

This is another case that GCC 7 is going to warn about.

There aren't many more left in all of Wine, though, which speaks for 
the quality of the codebase. ;-)


Signed-off-by: Gerald Pfeifer <gerald at>
 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 fc68fe1..f2fe25c 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -200,7 +200,7 @@ static BOOL proxy_active(void)
 static void _test_status_code(unsigned line, HINTERNET req, DWORD excode, BOOL is_todo)
     DWORD code, size, index;
-    char exbuf[10], bufa[10];
+    char exbuf[12], bufa[10];
     WCHAR bufw[10];
     BOOL res;

More information about the wine-patches mailing list