pidgin: 50be1dba: purple_url_parse() now gracefully handle...

evands at pidgin.im evands at pidgin.im
Tue Aug 26 23:00:40 EDT 2008


-----------------------------------------------------------------
Revision: 50be1dba5568bb36004d300f202b0dd3af444053
Ancestor: 23de00c9ca4c1e5f6d10ff40c78d2647432260de
Author: evands at pidgin.im
Date: 2008-08-27T02:54:59
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/50be1dba5568bb36004d300f202b0dd3af444053

Modified files:
        libpurple/util.c

ChangeLog: 

purple_url_parse() now gracefully handles a url which is wholly invalid.
Previously, if sscanf() failed, it would assign *ret_host to g_strdup()'d
garbage. Now it assigns it to NULL.

This probably fixes more than a single issue, but specifically it fixes
a crash which could occur when querying UPnP on a WR641G router in some
situations because the router would lead us to look up the url "/ipc".

-------------- next part --------------
============================================================
--- libpurple/util.c	643ccf2c5fb47d61cfdd57e5eeff34ccb023c7c7
+++ libpurple/util.c	f988f5485bc14ebded5f981d20b14d2c585375fd
@@ -3578,7 +3578,10 @@ purple_url_parse(const char *url, char *
 		g_snprintf(port_str, sizeof(port_str), "80");
 	}
 
-	if (f == 1)
+	if (f == 0)
+		*host = '\0';
+
+	if (f <= 1)
 		*path = '\0';
 
 	sscanf(port_str, "%d", &port);


More information about the Commits mailing list