# HG changeset patch # User Tobias Markmann # Date 1217695384 0 # Node ID 94c8bef52c6650c75ac3aa021054e2aee3dd0f58 # Parent 3c3480683075ec5f10beae8433ee7c89b3e7e522 * some further bugfixing, BIND's libresolv does so much for the programmer, just happy it exists diff -r 3c3480683075 -r 94c8bef52c66 libpurple/dnssrv.c --- a/libpurple/dnssrv.c Fri Aug 01 22:37:51 2008 +0000 +++ b/libpurple/dnssrv.c Sat Aug 02 16:43:04 2008 +0000 @@ -122,6 +122,7 @@ 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 @@ } 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 @@ 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 @@ 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; }