diff options
author | Gerald Combs <gerald@wireshark.org> | 2011-06-08 20:58:44 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2011-06-08 20:58:44 +0000 |
commit | 2eff7bab6626bedab9d9919d8ddd4976bf96f5b3 (patch) | |
tree | b01bc5f9004f3c2623e7ade23f5ac62ba362c136 /wiretap/ascend_scanner.l | |
parent | 5bcc2dc2f7f44d12cb61feb57cec869adf436162 (diff) |
Limit the lengths of some of our patterns. Fixes an infinite loop found
when trying to read a TPNCP data file.
svn path=/trunk/; revision=37625
Diffstat (limited to 'wiretap/ascend_scanner.l')
-rw-r--r-- | wiretap/ascend_scanner.l | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/wiretap/ascend_scanner.l b/wiretap/ascend_scanner.l index e669db287e..69ad4f1bbd 100644 --- a/wiretap/ascend_scanner.l +++ b/wiretap/ascend_scanner.l @@ -16,17 +16,17 @@ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -55,7 +55,7 @@ FILE_T yy_fh; extern char *ascend_ra_ptr; extern char *ascend_ra_last; #define YY_INPUT(buf,result,max_size) { int c = file_getc(yy_fh); \ -result = (c==EOF) ? YY_NULL : (buf[0] = c, 1); } +result = (c==EOF) ? YY_NULL : (buf[0] = c, 1); } int at_eof; int mul, scratch; @@ -159,17 +159,17 @@ WDD_TYPE "type "[^\n\r\t ]+ return WDS_PREFIX; } -<sc_ether_direction>[^\(]+ { +<sc_ether_direction>[^\(]{2,20} { BEGIN(sc_gen_task); - return STRING; + return STRING; } -<sc_isdn_call>[^\/\(:]+ { +<sc_isdn_call>[^\/\(:]{2,20} { BEGIN(sc_gen_task); return DECNUM; } -<sc_wds_user>[^:]+ { +<sc_wds_user>[^:]{2,20} { char *atcopy = g_strdup(ascendtext); char colon = input(); char after = input(); @@ -200,7 +200,7 @@ WDD_TYPE "type "[^\n\r\t ]+ return DECNUM; } -<sc_gen_task>(0x|0X)?{H}+ { +<sc_gen_task>(0x|0X)?{H}{2,8} { BEGIN(sc_gen_time_s); ascendlval.d = strtoul(ascendtext, NULL, 16); return HEXNUM; @@ -210,13 +210,13 @@ WDD_TYPE "type "[^\n\r\t ]+ return STRING; } -<sc_gen_time_s>{D}+ { +<sc_gen_time_s>{D}{1,10} { BEGIN(sc_gen_time_u); ascendlval.d = strtol(ascendtext, NULL, 10); return DECNUM; } -<sc_gen_time_u>{D}+ { +<sc_gen_time_u>{D}{1,6} { char *atcopy = g_strdup(ascendtext); BEGIN(sc_gen_octets); /* only want the most significant 2 digits. convert to usecs */ @@ -227,7 +227,7 @@ WDD_TYPE "type "[^\n\r\t ]+ return DECNUM; } -<sc_gen_octets>{D}+ { +<sc_gen_octets>{D}{1,10} { BEGIN(sc_gen_counter); ascendlval.d = strtol(ascendtext, NULL, 10); return DECNUM; @@ -243,11 +243,11 @@ WDD_TYPE "type "[^\n\r\t ]+ return HEXBYTE; } -<sc_gen_byte>" "{4} { +<sc_gen_byte>" "{4} { BEGIN(sc_chardisp); } -<sc_chardisp>.* { +<sc_chardisp>.* { BEGIN(sc_gen_byte); } @@ -315,7 +315,7 @@ WDD_TYPE "type "[^\n\r\t ]+ return WDD_CHUNK; } -<sc_wdd_chunknum>{H}+ { +<sc_wdd_chunknum>{H}{1,8} { BEGIN(sc_wdd_type); ascendlval.d = strtoul(ascendtext, NULL, 16); return HEXNUM; @@ -349,7 +349,7 @@ void ascend_init_lexer(FILE_T fh) /* * We want to stop processing when we get to the end of the input. - * (%option noyywrap is not used because if used then + * (%option noyywrap is not used because if used then * some flex versions (eg: 2.5.35) generate code which causes * warnings by the Windows VC compiler). */ |