# HG changeset patch # User Daniel Atallah # Date 1194909412 0 # Node ID 2b6553584385d14a3380a0fc69efdbf5a09d9e1a # Parent 31fc6a0769ce843df5939c335345769cb5d78724 Don't allow the buffer to be overrun when you have lots of local IPs. diff -r 31fc6a0769ce -r 2b6553584385 libpurple/protocols/bonjour/jabber.c --- a/libpurple/protocols/bonjour/jabber.c Mon Nov 12 23:10:08 2007 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Mon Nov 12 23:16:52 2007 +0000 @@ -997,7 +997,7 @@ guint32 lhost = htonl(127 * 256 * 256 * 256 + 1); long unsigned int add; int source = fd; - int len; + int len, count = 0; if (fd < 0) source = socket(PF_INET, SOCK_STREAM, 0); @@ -1013,7 +1013,7 @@ memcpy(ip_ext, "0.0.0.0", 7); tmp = buffer; tip = ip_ext; - while (tmp < buffer + ifc.ifc_len) + while (tmp < buffer + ifc.ifc_len && count < 10) { ifr = (struct ifreq *)tmp; tmp += HX_SIZE_OF_IFREQ(*ifr); @@ -1030,6 +1030,7 @@ ((add >> 8) & 255), add & 255); tip = (char*) ((int) tip + len); + count++; continue; } }