[PATCH 13/16] [NetApi32]: NetpGetComputerName

Eric Pouech eric.pouech at wanadoo.fr
Sun Oct 22 14:48:45 CDT 2006


- fix the size of allocation for the string returned from
  NetpGetComputerName (off by one error)
  (spotted by valgrind)

A+
---

 dlls/netapi32/wksta.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/netapi32/wksta.c b/dlls/netapi32/wksta.c
index 1d22fc6..d89cd1a 100644
--- a/dlls/netapi32/wksta.c
+++ b/dlls/netapi32/wksta.c
@@ -445,7 +445,7 @@ NET_API_STATUS WINAPI NetpGetComputerNam
     if (GetComputerNameW(*Buffer,  &dwSize))
     {
         NetApiBufferReallocate(
-            *Buffer, dwSize * sizeof(WCHAR),
+            *Buffer, (dwSize + 1) * sizeof(WCHAR),
             (LPVOID *) Buffer);
         return NERR_Success;
     }



More information about the wine-patches mailing list