soc.2008.xmpp: 30db35b1: * some further bugfixing, BIND's libreso...

tfar at soc.pidgin.im tfar at soc.pidgin.im
Sun Aug 3 14:10:43 EDT 2008


-----------------------------------------------------------------
Revision: 30db35b1bd32ae530ca1552cce8c4cc264de9f1c
Ancestor: 35cdb6d64c4b40a8a00890be3a7a32c87d33ff53
Author: tfar at soc.pidgin.im
Date: 2008-08-02T16:43:04
Branch: im.pidgin.soc.2008.xmpp
URL: http://d.pidgin.im/viewmtn/revision/info/30db35b1bd32ae530ca1552cce8c4cc264de9f1c

Modified files:
        libpurple/dnssrv.c

ChangeLog: 

* some further bugfixing, BIND's libresolv does so much for the programmer, just happy it exists

-------------- next part --------------
============================================================
--- libpurple/dnssrv.c	a90ec59807cfb4c03e43c5d0d64f341ef0211e51
+++ libpurple/dnssrv.c	8dd4e8c77e759b9bd0e43033f2fd80431134f5b5
@@ -122,6 +122,7 @@ resolve(int in, int out)
 	gchar name[256];
 	guint16 type, dlen, pref, weight, port;
 	PurpleSrvInternalQuery query;
+	int n;
 
 #ifdef HAVE_SIGNAL_H
 	purple_restore_default_signal_handlers();
@@ -134,10 +135,9 @@ resolve(int in, int out)
 	}
 
 	size = res_query( query.query, C_IN, query.type, (u_char*)&answer, sizeof( answer));
-
+	
 	qdcount = ntohs(answer.hdr.qdcount);
 	ancount = ntohs(answer.hdr.ancount);
-
 	cp = (guchar*)&answer + sizeof(HEADER);
 	end = (guchar*)&answer + size;
 
@@ -152,16 +152,13 @@ resolve(int in, int out)
 		size = dn_expand((unsigned char*)&answer, end, cp, name, 256);
 		if(size < 0)
 			goto end;
-
 		cp += size;
-
 		GETSHORT(type,cp);
 
 		/* skip ttl and class since we already know it */
 		cp += 6;
 
 		GETSHORT(dlen,cp);
-
 		if (query.type == T_SRV) {
 			GETSHORT(pref,cp);
 
@@ -183,13 +180,10 @@ resolve(int in, int out)
 
 			ret = g_list_insert_sorted(ret, srvres, responsecompare);
 		} else if (query.type == T_TXT) {
-			size = dn_expand( (unsigned char*)&answer, end, cp, name, 256);
-			if(size < 0 )
-				goto end;
 			txtres = g_new0(PurpleTxtResponse, 1);
-			strcpy(txtres->content, name);
-			
+			strncpy(txtres->content, ++cp, dlen-1);
 			ret = g_list_append(ret, txtres);
+			cp += dlen - 1;
 		} else {
 			cp += dlen;
 		}


More information about the Commits mailing list