Marcus Meissner : wmc: Duplicate wine_cp_wcstombs check here too (Coverity) .
Alexandre Julliard
julliard at winehq.org
Mon Jul 20 07:36:57 CDT 2009
Module: wine
Branch: master
Commit: 29bdb32592ffcff1500b6b14e714e5fc1ad7ec05
URL: http://source.winehq.org/git/wine.git/?a=commit;h=29bdb32592ffcff1500b6b14e714e5fc1ad7ec05
Author: Marcus Meissner <marcus at jet.franken.de>
Date: Sat Jul 18 22:23:45 2009 +0200
wmc: Duplicate wine_cp_wcstombs check here too (Coverity).
---
tools/wmc/write.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/wmc/write.c b/tools/wmc/write.c
index 22858b8..7f9784f 100644
--- a/tools/wmc/write.c
+++ b/tools/wmc/write.c
@@ -396,8 +396,13 @@ static char *make_string(WCHAR *uc, int len, int codepage)
else
mlen = wine_utf8_wcstombs(0, uc, unistrlen(uc)+1, NULL, 0);
cc = tmp = xmalloc(mlen);
- if((i = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, tmp, mlen, NULL, NULL)) < 0)
- internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", i);
+ if (cpdef) {
+ if((i = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, tmp, mlen, NULL, NULL)) < 0)
+ internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", i);
+ } else {
+ if((i = wine_utf8_wcstombs(0, uc, unistrlen(uc)+1, tmp, mlen)) < 0)
+ internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", i);
+ }
*cptr++ = ' ';
*cptr++ = '"';
for(i = b = 0; i < len; i++, cc++)
More information about the wine-cvs
mailing list