netapi32: Return an empty comment instead of NULL pointer in NetServerGetInfo

Bruno Jesus 00cpxxx at gmail.com
Fri Mar 20 23:18:40 CDT 2015


Fixes https://bugs.winehq.org/show_bug.cgi?id=35135
-------------- next part --------------
diff --git a/dlls/netapi32/netapi32.c b/dlls/netapi32/netapi32.c
index f7701e3..f9bfb48 100644
--- a/dlls/netapi32/netapi32.c
+++ b/dlls/netapi32/netapi32.c
@@ -1042,7 +1042,8 @@ NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bu
             GetComputerNameW(computerName, &computerNameLen);
             computerNameLen++; /* include NULL terminator */
 
-            size = sizeof(SERVER_INFO_101) + computerNameLen * sizeof(WCHAR);
+            /* Plus 1 for empty comment */
+            size = sizeof(SERVER_INFO_101) + (computerNameLen + 1) * sizeof(WCHAR);
             ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
             if (ret == NERR_Success)
             {
@@ -1060,7 +1061,9 @@ NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bu
                 info->sv101_version_minor = verInfo.dwMinorVersion;
                  /* Use generic type as no wine equivalent of DC / Server */
                 info->sv101_type = SV_TYPE_NT;
-                info->sv101_comment = NULL;
+                info->sv101_comment = (LMSTR)(*bufptr + sizeof(SERVER_INFO_101)
+                                              + computerNameLen * sizeof(WCHAR));
+                info->sv101_comment[0] = '\0';
             }
             break;
         }


More information about the wine-patches mailing list