Lines 211-217
Link Here
|
211 |
void |
211 |
void |
212 |
expand_domain_search(struct packet *packet) |
212 |
expand_domain_search(struct packet *packet) |
213 |
{ |
213 |
{ |
214 |
int offset, expanded_len; |
214 |
int offset, expanded_len, next_domain_len; |
215 |
struct option_data *option; |
215 |
struct option_data *option; |
216 |
unsigned char *domain_search, *cursor; |
216 |
unsigned char *domain_search, *cursor; |
217 |
|
217 |
|
Lines 224-232
Link Here
|
224 |
expanded_len = 0; |
224 |
expanded_len = 0; |
225 |
offset = 0; |
225 |
offset = 0; |
226 |
while (offset < option->len) { |
226 |
while (offset < option->len) { |
|
|
227 |
next_domain_len = find_search_domain_name_len(option, &offset); |
228 |
if (next_domain_len < 0) |
229 |
/* The Domain Search option value is invalid. */ |
230 |
return; |
231 |
|
227 |
/* We add 1 for the space between domain names. */ |
232 |
/* We add 1 for the space between domain names. */ |
228 |
expanded_len += |
233 |
expanded_len += next_domain_len + 1; |
229 |
find_search_domain_name_len(option, &offset) + 1; |
|
|
230 |
} |
234 |
} |
231 |
if (expanded_len > 0) |
235 |
if (expanded_len > 0) |
232 |
/* Remove 1 for the superfluous trailing space. */ |
236 |
/* Remove 1 for the superfluous trailing space. */ |
Lines 271-278
Link Here
|
271 |
/* This is a pointer to another list of labels. */ |
275 |
/* This is a pointer to another list of labels. */ |
272 |
if (i + 1 >= option->len) { |
276 |
if (i + 1 >= option->len) { |
273 |
/* The pointer is truncated. */ |
277 |
/* The pointer is truncated. */ |
274 |
error("Truncated pointer in DHCP Domain " |
278 |
warning("Truncated pointer in DHCP Domain " |
275 |
"Search option."); |
279 |
"Search option."); |
|
|
280 |
return (-1); |
276 |
} |
281 |
} |
277 |
|
282 |
|
278 |
pointer = ((label_len & ~(0xC0)) << 8) + |
283 |
pointer = ((label_len & ~(0xC0)) << 8) + |
Lines 282-289
Link Here
|
282 |
* The pointer must indicates a prior |
287 |
* The pointer must indicates a prior |
283 |
* occurance. |
288 |
* occurance. |
284 |
*/ |
289 |
*/ |
285 |
error("Invalid forward pointer in DHCP Domain " |
290 |
warning("Invalid forward pointer in DHCP " |
286 |
"Search option compression."); |
291 |
"Domain Search option compression."); |
|
|
292 |
return (-1); |
287 |
} |
293 |
} |
288 |
|
294 |
|
289 |
pointed_len = find_search_domain_name_len(option, |
295 |
pointed_len = find_search_domain_name_len(option, |
Lines 295-301
Link Here
|
295 |
} |
301 |
} |
296 |
|
302 |
|
297 |
if (i + label_len >= option->len) { |
303 |
if (i + label_len >= option->len) { |
298 |
error("Truncated label in DHCP Domain Search option."); |
304 |
warning("Truncated label in DHCP Domain Search " |
|
|
305 |
"option."); |
306 |
return (-1); |
299 |
} |
307 |
} |
300 |
|
308 |
|
301 |
/* |
309 |
/* |
Lines 308-316
Link Here
|
308 |
i += label_len + 1; |
316 |
i += label_len + 1; |
309 |
} |
317 |
} |
310 |
|
318 |
|
311 |
error("Truncated DHCP Domain Search option."); |
319 |
warning("Truncated DHCP Domain Search option."); |
312 |
|
320 |
|
313 |
return (0); |
321 |
return (-1); |
314 |
} |
322 |
} |
315 |
|
323 |
|
316 |
void |
324 |
void |