Integer Overflow of Allocation Size at text2pcap-scanner.c:1044 |
No properties have been set. edit properties |
Jump to warning location ↓ | warning details... |
| |
yy_get_next_buffer (/home/sate/Testcases/c/cve/wireshark-1.2.0/text2pcap-scanner.c)![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
979 | static int yy_get_next_buffer (void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
980 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
981 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
982 | register char *source = (yytext_ptr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
983 | register int number_to_move, i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
984 | int ret_val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
985 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
986 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
987 | YY_FATAL_ERROR( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
988 | "fatal flex scanner internal error--end of buffer missed" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
989 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
990 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
991 | { /* Don't try to fill the buffer, so this is an EOF. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
992 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
993 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
994 | /* We matched a single character, the EOB, so | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
995 | * treat this as a final EOF. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
996 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
997 | return EOB_ACT_END_OF_FILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
998 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
999 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1000 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1001 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1002 | /* We matched some text prior to the EOB, first | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1003 | * process it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1004 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1005 | return EOB_ACT_LAST_MATCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1006 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1007 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1008 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1009 | /* Try to read more data. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1010 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1011 | /* First move last chars to start of buffer. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1012 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1013 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1014 | for ( i = 0; i < number_to_move; ++i ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1015 | *(dest++) = *(source++); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1016 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1017 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1018 | /* don't do the read, it's not guaranteed to return an EOF, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1019 | * just force an EOF | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1020 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1021 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1022 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1023 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1024 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1025 | int num_to_read = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1026 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1027 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1028 | while ( num_to_read <= 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1029 | { /* Not enough room in the buffer - grow it. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1030 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1031 | /* just a shorter name for the current buffer */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1032 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1033 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1034 | int yy_c_buf_p_offset = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1035 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1036 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1037 | if ( b->yy_is_our_buffer ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1038 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1039 | int new_size = b->yy_buf_size * 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1040 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1041 | if ( new_size <= 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1042 | b->yy_buf_size += b->yy_buf_size / 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1043 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1044 | b->yy_buf_size *= 2;
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1045 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1046 | b->yy_ch_buf = (char *) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1047 | /* Include room in for 2 EOB chars. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1048 | [+] | yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1049 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1050 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1051 | /* Can't grow it, we don't own it. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1052 | b->yy_ch_buf = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1053 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1054 | if ( ! b->yy_ch_buf ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1055 | YY_FATAL_ERROR( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1056 | "fatal error - scanner input buffer overflow" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1057 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1058 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1059 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1060 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1061 | number_to_move - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |