wrc debug buffer overflow fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
Fix strncpyWtoA from wrc to actually act as advertised (and not overflow
the input buffer).
Small cleanups of it at the same time.

Vincent
Index: wine/tools/wrc/dumpres.c
===================================================================
RCS file: /home/wine/wine/tools/wrc/dumpres.c,v
retrieving revision 1.14
diff -u -r1.14 dumpres.c
--- wine/tools/wrc/dumpres.c	31 May 2002 23:41:01 -0000	1.14
+++ wine/tools/wrc/dumpres.c	21 Sep 2003 19:58:36 -0000
@@ -81,13 +81,12 @@
 char *strncpyWtoA(char *cs, short *ws, int maxlen)
 {
 	char *cptr = cs;
-	short *wsMax = ws + maxlen;
-	while(ws < wsMax)
+	short *wsMax = ws + maxlen - 1;
+	while(*ws && ws < wsMax)
 	{
 		if(*ws < -128 || *ws > 127)
-			printf("***Warning: Unicode string contains non-printable chars***");
+			fprintf(stderr, "***Warning: Unicode string contains non-printable chars***\n");
 		*cptr++ = (char)*ws++;
-		maxlen--;
 	}
 	*cptr = '\0';
 	return cs;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux