Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/jingle/rawudp.c @ 26838:cfde0f7fd54f
Don't crash on malicious candidates missing attributes
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 30 Apr 2009 03:40:50 +0000 |
parents | 5631378c68c8 |
children | c585572e80dd |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/rawudp.c Thu Apr 30 02:59:24 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rawudp.c Thu Apr 30 03:40:50 2009 +0000 @@ -278,12 +278,21 @@ JingleRawUdpCandidate *rawudp_candidate = NULL; for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { + const gchar *id = xmlnode_get_attrib(candidate, "id"); + const gchar *generation = xmlnode_get_attrib(candidate, "generation"); + const gchar *component = xmlnode_get_attrib(candidate, "component"); + const gchar *ip = xmlnode_get_attrib(candidate, "ip"); + const gchar *port = xmlnode_get_attrib(candidate, "port"); + + if (!id || !generation || !component || !ip || !port) + continue; + rawudp_candidate = jingle_rawudp_candidate_new( - xmlnode_get_attrib(candidate, "id"), - atoi(xmlnode_get_attrib(candidate, "generation")), - atoi(xmlnode_get_attrib(candidate, "component")), - xmlnode_get_attrib(candidate, "ip"), - atoi(xmlnode_get_attrib(candidate, "port"))); + id, + atoi(generation), + atoi(component), + ip, + atoi(port)); rawudp_candidate->rem_known = TRUE; jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); }