im.pidgin.pidgin: 26c89c1a2c237cf3636f965d8d3f64094a986c61

datallah at pidgin.im datallah at pidgin.im
Mon Nov 12 18:21:07 EST 2007


-----------------------------------------------------------------
Revision: 26c89c1a2c237cf3636f965d8d3f64094a986c61
Ancestor: af42002047d95678720311b8bed8776ceda1142a
Author: datallah at pidgin.im
Date: 2007-11-12T23:16:52
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/bonjour/jabber.c

ChangeLog: 

Don't allow the buffer to be overrun when you have lots of local IPs.

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/jabber.c	e5ae3b581340d9231c23ca4391cd68cf59b84dd4
+++ libpurple/protocols/bonjour/jabber.c	c73dc0e804241bb6306675e5ef190c7416cf8cb8
@@ -997,7 +997,7 @@ purple_network_get_my_ip_ext2(int fd)
 	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 @@ purple_network_get_my_ip_ext2(int fd)
 	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 @@ purple_network_get_my_ip_ext2(int fd)
 					((add >> 8) & 255),
 					add & 255);
 				tip = (char*) ((int) tip + len);
+				count++;
 				continue;
 			}
 		}


More information about the Commits mailing list