/pidgin/main: 38653c63a0d2: Fix sizeof calls.

Mark Doliner mark at kingant.net
Wed Oct 22 10:20:23 EDT 2014


Changeset: 38653c63a0d28f67ae9eb14341c3d793645c3529
Author:	 Mark Doliner <mark at kingant.net>
Date:	 2014-03-01 17:04 -0800
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/38653c63a0d2

Description:

Fix sizeof calls.

Sorry, forgot that sizeof(pointer to stack buffer) doesn't do what
I want.

diffstat:

 pidgin/win32/untar.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (30 lines):

diff --git a/pidgin/win32/untar.c b/pidgin/win32/untar.c
--- a/pidgin/win32/untar.c
+++ b/pidgin/win32/untar.c
@@ -392,22 +392,22 @@ static int untar_block(Uchar_t *blk) {
 
 		/* combine prefix and filename */
 		memset(nbuf, 0, sizeof nbuf);
-		name = nbuf;
 		if ((tblk)->prefix[0])
 		{
-			snprintf(name, sizeof(name), "%s/%s",
+			snprintf(nbuf, sizeof(nbuf), "%s/%s",
 				(tblk)->prefix, (tblk)->filename);
 		}
 		else
 		{
-			g_strlcpy(name, (tblk)->filename,
-				sizeof (name));
+			g_strlcpy(nbuf, (tblk)->filename,
+				sizeof (nbuf));
 		}
 
 		/* Convert any backslashes to forward slashes, and guard
 		 * against doubled-up slashes. (Some DOS versions of "tar"
 		 * get this wrong.)  Also strip off leading slashes.
 		 */
+		name = nbuf;
 		if (!ABSPATH && (*name == '/' || *name == '\\'))
 			didabs = 1;
 		for (n2 = nbuf; *name; name++)



More information about the Commits mailing list