pidgin: f5f0cca8: Terminate the loop on the first null-cha...

sadrul at pidgin.im sadrul at pidgin.im
Tue Jan 6 17:46:29 EST 2009


-----------------------------------------------------------------
Revision: f5f0cca8a5f385b7c637236b48aceef1aaa97899
Ancestor: df2a3406011776c81e22d17fb2c43581cfc05883
Author: sadrul at pidgin.im
Date: 2009-01-06T19:50:18
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f5f0cca8a5f385b7c637236b48aceef1aaa97899

Modified files:
        libpurple/protocols/myspace/myspace.c

ChangeLog: 

Terminate the loop on the first null-character.

(Currently it would not terminate for the first null in, e.g. "1 2 \0 3")

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/myspace.c	fbc92dbf6b0e3598b173a27046e88394eac9d924
+++ libpurple/protocols/myspace/myspace.c	c90f6f23b14c656ab70d6f478d920f0128276afa
@@ -2876,10 +2876,9 @@ static const char *msim_normalize(const 
 	}
 
 	/* Strip spaces. */
-	for (i=0, j=0; normalized[j]; i++, j++) {
-		while (normalized[j] == ' ')
-			j++;
-		normalized[i] = normalized[j];
+	for (i=0, j=0; normalized[j]; j++) {
+		if (normalized[j] != ' ')
+			normalized[i++] = normalized[j];
 	}
 	normalized[i] = '\0';
 


More information about the Commits mailing list