[PATCH] netstat: allocate WCHARs not CHARs (Coverity)
Marcus Meissner
marcus at jet.franken.de
Sun Sep 29 03:52:04 CDT 2013
1099509 Wrong size argument
Coverity actually wondered here about the 65535 byte as it is not
dividible by sizeof(WCHAR).
As the A output buffer is allowed to go to 65535, we should make the W
buffer go to sizeof(WCHAR)*65535 at least.
This is a new checker I think as it is a new, while the code is from
last year.
Ciao, Marcus
---
programs/netstat/netstat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/netstat/netstat.c b/programs/netstat/netstat.c
index fab39e3..0e52c36 100644
--- a/programs/netstat/netstat.c
+++ b/programs/netstat/netstat.c
@@ -90,7 +90,7 @@ static int __cdecl NETSTAT_wprintf(const WCHAR *format, ...)
*/
if (!output_bufW) output_bufW = HeapAlloc(GetProcessHeap(), 0,
- MAX_WRITECONSOLE_SIZE);
+ MAX_WRITECONSOLE_SIZE*sizeof(WCHAR));
if (!output_bufW) {
WINE_FIXME("Out of memory - could not allocate 2 x 64K buffers\n");
return 0;
--
1.7.10.4
More information about the wine-patches
mailing list