From 5428e8ddbe92c80e28189be5039a49feee9d2242 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 30 Sep 2018 21:23:04 -0700 Subject: [PATCH] Fix handling of some ISDN calls. There's no guarantee that there will be two digits after PRI-XMIT or PRI-RCV; the capture file in bug 3535, for exmaple, has "PRI-XMIT-0/1" and "PRI-RCV-0". Require a minimum of 1, not 2, non-{/(:} characters. Leave the maximum of 20 in place. Change-Id: Ie8f8f4ff5eb04baf0ee61bf28015e59a1fa43948 Reviewed-on: https://code.wireshark.org/review/29947 Reviewed-by: Guy Harris --- wiretap/ascend_scanner.l | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/wiretap/ascend_scanner.l b/wiretap/ascend_scanner.l index d004fc90cb..befe5aa019 100644 --- a/wiretap/ascend_scanner.l +++ b/wiretap/ascend_scanner.l @@ -196,12 +196,28 @@ WDD_TYPE "type "[^\n\r\t ]+ return WDS_PREFIX; } + /* + * If we allow an arbitrary non-zero number of non-left-parentheses after + * "ETHER", that means that some file that has ETHER followed by a lot of + * text (see, for example, tpncp/tpncp.dat in the source tree) can cause + * either an infinite loop or a loop that take forever to finish, as the + * scanner keeps swallowing characters. Limit it to 20 characters. + * + * XXX - any reason to require at least two of them? + */ [^\(]{2,20} { BEGIN(sc_gen_task); return STRING; } -[^\/\(:]{2,20} { + /* + * If we allow an arbitrary non-zero number of non-slash, non-left-parentheses, + * non-colon characters after "PRI-XMIT", that means that some file that has + * PRI-XMIT= followed by a lot of text can cause either an infinite loop or + * a loop that take forever to finish, as the scanner keeps swallowing + * characters. Limit it to 20 characters. + */ +[^\/\(:]{1,20} { BEGIN(sc_gen_task); return DECNUM; }