]>
Commit | Line | Data |
---|---|---|
ba2d5250 | 1 | Index: avahi-core/dns.c |
2 | =================================================================== | |
3 | --- avahi-core/dns.c (Revision 1339) | |
4 | +++ avahi-core/dns.c (Arbeitskopie) | |
5 | @@ -331,7 +331,7 @@ | |
6 | static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_t l) { | |
7 | int ret = 0; | |
8 | int compressed = 0; | |
9 | - int first_label = 1; | |
10 | + int first_label = 1, label_ptr; | |
11 | assert(p && ret_name && l); | |
12 | ||
13 | for (;;) { | |
14 | @@ -384,8 +384,13 @@ | |
15 | if (idx+2 > p->size) | |
16 | return -1; | |
17 | ||
18 | - idx = ((unsigned) (AVAHI_DNS_PACKET_DATA(p)[idx] & ~0xC0)) << 8 | AVAHI_DNS_PACKET_DATA(p)[idx+1]; | |
19 | + label_ptr = ((unsigned) (AVAHI_DNS_PACKET_DATA(p)[idx] & ~0xC0)) << 8 | AVAHI_DNS_PACKET_DATA(p)[idx+1]; | |
20 | ||
21 | + if (label_ptr >= idx) | |
22 | + return -1; | |
23 | + | |
24 | + idx = label_ptr; | |
25 | + | |
26 | if (!compressed) | |
27 | ret += 2; | |
28 |