[PATCH] winspool.drv: also do not pass in NULL ptr if not allocated (Coverity)

Marcus Meissner marcus at jet.franken.de
Wed Dec 2 03:12:57 CST 2009


Hi,

Clarify that ptr is not passed in if size > cbBuf.
Swap condition order to match the one in the if () above.

This is CID 1000 btw. :)

Ciao, Marcus
---
 dlls/winspool.drv/info.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index aa6f305..6e5bd20 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -4525,8 +4525,8 @@ BOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment,
         ptr = pDriverInfo + size;
 
     if(!WINSPOOL_GetDriverInfoFromReg(hkeyDrivers, DriverName,
-                         env, Level, pDriverInfo, ptr,
-                         (cbBuf < size) ? 0 : cbBuf - size,
+                         env, Level, pDriverInfo, (size > cbBuf) ? NULL : ptr,
+                         (size > cbBuf) ? 0 : cbBuf - size,
                          &needed, TRUE)) {
             RegCloseKey(hkeyDrivers);
             return FALSE;
-- 
1.5.6



More information about the wine-patches mailing list