pidgin.2.5.5.veracode: 92351578: Prevent a NUL ptr deref when the passpor...

datallah at pidgin.im datallah at pidgin.im
Thu May 14 17:36:36 EDT 2009


-----------------------------------------------------------------
Revision: 923515782d44c610768493eed9ddf3664c195b21
Ancestor: b14728379c16e92457492a7a4fc9a6b616e3fbe4
Author: datallah at pidgin.im
Date: 2009-05-02T19:33:22
Branch: im.pidgin.pidgin.2.5.5.veracode
URL: http://d.pidgin.im/viewmtn/revision/info/923515782d44c610768493eed9ddf3664c195b21

Modified files:
        libpurple/protocols/msn/oim.c

ChangeLog: 

Prevent a NUL ptr deref when the passport is malformed.
This came out of the veracode analysis.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/oim.c	5671d21f5fd46800410767e4be9176ac756afdfd
+++ libpurple/protocols/msn/oim.c	9a90bf63cdc2b3240d803c9eba33886848e48ce3
@@ -668,9 +668,15 @@ msn_oim_report_to_user(MsnOimRecvData *r
 		if (tokens[1] != NULL)
 			from = (const char *)tokens[1];
 
-		start = strchr(from, '<') + 1;
-		end = strchr(from, '>');
-		passport = g_strndup(start, end - start);
+		start = strchr(from, '<');
+		if (start != NULL) {
+			start++;
+			end = strchr(from, '>');
+			if (end != NULL)
+				passport = g_strndup(start, end - start);
+		}
+		if (passport == NULL)
+			passport = g_strdup(_("Unknown"));
 
 		g_strfreev(tokens);
 	}


More information about the Commits mailing list