user.exe16: Fix a misplaced closing bracket (PVS-Studio)

Michael Stefaniuc mstefani at redhat.de
Wed Oct 14 14:36:33 CDT 2015


Previous code was setting ret to 1 for negative return values of
vsnprintf; that would fail on glibc 2.0.6 and older.

Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
---
>From the man page NOTES:
 The glibc implementation of the functions snprintf()  and  vsnprintf()
 conforms  to  the  C99  standard, that is, behaves as described above,
 since glibc version 2.1.  Until glibc 2.0.6, they would return -1 when
 the output was truncated.

 dlls/user.exe16/user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/user.exe16/user.c b/dlls/user.exe16/user.c
index d16a1b4..aba797d 100644
--- a/dlls/user.exe16/user.c
+++ b/dlls/user.exe16/user.c
@@ -3244,7 +3244,7 @@ DWORD WINAPI FormatMessage16(
                         argliststart=args+insertnr-1;
 
                         /* CMF - This makes a BIG assumption about va_list */
-                        while ((ret = vsnprintf(b, sz, fmtstr, (va_list) argliststart) < 0) || (ret >= sz)) {
+                        while ((ret = vsnprintf(b, sz, fmtstr, (va_list) argliststart)) < 0 || ret >= sz) {
                             sz = (ret == -1 ? sz + 100 : ret + 1);
                             b = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, b, sz);
                         }
-- 
2.4.3



More information about the wine-patches mailing list