Changeset 50670 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Mar 4, 2014 1:00:02 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92608
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/resolv_conf_parser.c
r50150 r50670 29 29 #include "resolv_conf_parser.h" 30 30 31 /* XXX: it's required to add the aliases for keywords and 32 * types to handle conditions more clearly */ 31 33 enum RCP_TOKEN 32 34 { … … 38 40 tok_ipv6 = -6, /* ipv6 */ 39 41 tok_ipv6_port = -7, /* ipv6 port */ 42 /* keywords */ 40 43 tok_nameserver = -8, /* nameserver */ 41 44 tok_port = -9, /* port, Mac OSX specific */ … … 382 385 * @note: resolv.conf (5) Linux: 383 386 * "The search list is currently limited to six domains with a total of 256 characters." 387 * @note: 'search' parameter could contains numbers only hex or decimal, 1c1e or 111 384 388 */ 385 389 static enum RCP_TOKEN rcp_parse_search(struct rcp_parser *parser) … … 393 397 st = parser->rcpp_state; 394 398 395 /**396 * We asume that duplication of search list in resolv.conf isn't correct.397 */398 399 if ( tok == tok_eof 399 || tok == tok_error 400 || tok != tok_string 401 || st->rcps_searchlist[0] != NULL) 400 || tok == tok_error) 402 401 return tok_error; 403 402 404 i = 0; 405 trailing = RCPS_BUFFER_SIZE; 406 do { 403 /* just ignore "too many search list" */ 404 if (st->rcps_num_searchlist >= RCPS_MAX_SEARCHLIST) 405 return rcp_get_token(parser); 406 407 /* we don't want accept keywords */ 408 if (tok <= tok_nameserver) 409 return tok; 410 411 /* if there're several entries of "search" we compose them together */ 412 i = st->rcps_num_searchlist; 413 if ( i == 0) 414 trailing = RCPS_BUFFER_SIZE; 415 else 416 { 417 ptr = st->rcps_searchlist[i - 1]; 418 trailing = RCPS_BUFFER_SIZE - (ptr - 419 st->rcps_searchlist_buffer + strlen(ptr) + 1); 420 } 421 422 while (1) 423 { 407 424 len = strlen(parser->rcpp_str_buffer); 408 425 … … 410 427 break; /* not enough room for new entry */ 411 428 429 if (i >= RCPS_MAX_SEARCHLIST) 430 break; /* not enought free entries for 'search' items */ 431 412 432 ptr = st->rcps_searchlist_buffer + RCPS_BUFFER_SIZE - trailing; 413 433 strcpy(ptr, parser->rcpp_str_buffer); … … 415 435 trailing -= len + 1; /* 1 reserved for '\0' */ 416 436 417 st->rcps_searchlist[i] = ptr; 418 419 } while( (tok = rcp_get_token(parser)) == tok_string 420 && ++i != RCPS_MAX_SEARCHLIST); 437 st->rcps_searchlist[i++] = ptr; 438 tok = rcp_get_token(parser); 439 440 /* token filter */ 441 if ( tok == tok_eof 442 || tok == tok_error 443 || tok <= tok_nameserver) 444 break; 445 } 421 446 422 447 st->rcps_num_searchlist = i;
Note:
See TracChangeset
for help on using the changeset viewer.