pidgin: e91ed68f: Shaun Lindsay at Meebo tracked down a bu...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Feb 25 22:50:28 EST 2009


-----------------------------------------------------------------
Revision: e91ed68fcf5fe524519519a32ae6fb779df1b877
Ancestor: aebbec66a641ac7d32be4412e1d7baff58ff981b
Author: markdoliner at pidgin.im
Date: 2009-02-26T03:44:58
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e91ed68fcf5fe524519519a32ae6fb779df1b877

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

ChangeLog: 

Shaun Lindsay at Meebo tracked down a bug where this function reads
past the end of the string if the input parameter ends in a space

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	40c973b4dd061f3de4d035b9957779a1ffa1bb47
+++ libpurple/protocols/oscar/oscar.c	399ab2ae8e442514cb9167a73b4d307ee82564f4
@@ -6818,11 +6818,13 @@ oscar_normalize(const PurpleAccount *acc
 	g_return_val_if_fail(str != NULL, NULL);
 
 	/* copy str to buf and skip all blanks */
-	for (i=0, j=0; str[j] && i < BUF_LEN - 1; i++, j++)
-	{
-		while (str[j] == ' ')
-			j++;
-		buf[i] = str[j];
+	i = 0;
+	for (j = 0; str[j]; j++) {
+		if (str[j] != ' ') {
+			buf[i++] = str[j];
+			if (i >= BUF_LEN - 1)
+				break;
+		}
 	}
 	buf[i] = '\0';
 


More information about the Commits mailing list