Changeset f1dcf6d in mainline
- Timestamp:
- 2013-04-20T09:38:59Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7262f89
- Parents:
- 9d8bd3ac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsres/dns_msg.c
r9d8bd3ac rf1dcf6d 47 47 #define NAME "dnsres" 48 48 49 static uint16_t dns_uint16_t_decode(uint8_t *, size_t); 50 49 51 #include <stdio.h> 50 52 static int dns_name_encode(char *name, uint8_t *buf, size_t buf_size, … … 117 119 size_t lsize; 118 120 size_t i; 121 size_t ptr; 122 size_t eptr; 119 123 120 124 if (boff > size) … … 129 133 } 130 134 131 132 135 lsize = *bp; 133 136 ++bp; … … 137 140 break; 138 141 139 if (bp != buf + 1)142 if (bp != buf + boff + 1) 140 143 printf("."); 141 144 142 145 if ((lsize & 0xc0) == 0xc0) { 146 printf("Pointer\n"); 143 147 /* Pointer */ 144 printf("compression not supported!\n"); 145 return EINVAL; 148 if (bsize < 1) { 149 printf("Pointer- bsize < 1\n"); 150 return EINVAL; 151 } 152 153 ptr = dns_uint16_t_decode(bp - 1, bsize) & 0x3fff; 154 if (ptr >= (size_t)(bp - buf)) { 155 printf("Pointer- forward ref %u, pos=%u\n", 156 ptr, bp - buf); 157 /* Forward reference */ 158 return EINVAL; 159 } 160 161 /* 162 * Make sure we will not decode any byte twice. 163 * XXX Is assumption correct? 164 */ 165 eptr = buf - bp; 166 167 printf("ptr=%u, eptr=%u\n", ptr, eptr); 168 bp = buf + ptr; 169 bsize = eptr - ptr; 170 continue; 146 171 } 147 172
Note:
See TracChangeset
for help on using the changeset viewer.