Changes in lib/misc.c [e252d8c:0e788f5]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/misc.c
re252d8c r0e788f5 420 420 void random_bytes( unsigned char *buf, int count ) 421 421 { 422 #ifndef _WIN32 422 423 static int use_dev = -1; 423 424 … … 469 470 470 471 if( !use_dev ) 472 #endif 471 473 { 472 474 int i; … … 523 525 ns_msg nsh; 524 526 ns_rr rr; 525 int n, len, size;527 int i, n, len, size; 526 528 527 529 g_snprintf( name, sizeof( name ), "_%s._%s.%s", service, protocol, domain ); … … 536 538 while( ns_parserr( &nsh, ns_s_an, n, &rr ) == 0 ) 537 539 { 538 char name[NS_MAXDNAME]; 539 540 if( ns_rr_rdlen( rr ) < 7) 541 break; 542 540 size = ns_rr_rdlen( rr ); 543 541 buf = ns_rr_rdata( rr ); 544 542 545 if( dn_expand(querybuf, querybuf + size, &buf[6], name, NS_MAXDNAME) == -1 ) 543 len = 0; 544 for( i = 6; i < size && buf[i]; i += buf[i] + 1 ) 545 len += buf[i] + 1; 546 547 if( i > size ) 546 548 break; 547 548 len = strlen(name) + 1;549 549 550 550 reply = g_malloc( sizeof( struct ns_srv_reply ) + len ); 551 memcpy( reply->name, name, len ); 551 memcpy( reply->name, buf + 7, len ); 552 553 for( i = buf[6]; i < len && buf[7+i]; i += buf[7+i] + 1 ) 554 reply->name[i] = '.'; 555 556 if( i > len ) 557 { 558 g_free( reply ); 559 break; 560 } 552 561 553 562 reply->prio = ( buf[0] << 8 ) | buf[1]; … … 673 682 white\ space in 'various ways'. Returns a NULL-terminated static 674 683 char** so watch out with nested use! Definitely not thread-safe. */ 675 char **split_command_parts( char *command , int limit)684 char **split_command_parts( char *command ) 676 685 { 677 686 static char *cmd[IRC_MAX_ARGS+1]; … … 683 692 k = 1; 684 693 for( s = command; *s && k < IRC_MAX_ARGS; s ++ ) 685 {686 694 if( *s == ' ' && !q ) 687 695 { 688 696 *s = 0; 689 697 while( *++s == ' ' ); 690 if( k != limit && (*s == '"' || *s == '\''))698 if( *s == '"' || *s == '\'' ) 691 699 { 692 700 q = *s; … … 696 704 { 697 705 cmd[k++] = s; 698 if (limit && k > limit) {699 break;700 }701 706 s --; 702 707 } … … 717 722 q = *s = 0; 718 723 } 719 }720 724 721 725 /* Full zero-padding for easier argc checking. */
Note: See TracChangeset
for help on using the changeset viewer.